Tapestry
  1. Tapestry
  2. TAPESTRY-2096

Confusing exception when autobuilding a class fails due to class visibility

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.9
    • Fix Version/s: 5.0.13
    • Component/s: tapestry-ioc
    • Labels:
      None

      Description

      The exception that occurs when a constructor can't be invoked because the class is not public is a bit confusing:

      ERROR] olive-notes Tapestry 5 Application /OliveNotes/blog/admin/createpost.postform;jsessionid=1szfzzqkr9bqo:
      java.lang.RuntimeException: Error invoking service builder method org.apache.tapestry.upload.services.UploadModule.buildMultipartDecoder(ThreadCleanupHub, RegistryShutdownHub, ObjectLocator) (at UploadModule.java:47) (for service 'MultipartDecoder'): Error invoking constructor org.apache.tapestry.upload.services.MultipartDecoderImpl(String, int, long, long) (at MultipartDecoderImpl.java:61) (for service 'MultipartDecoder'): Class org.apache.tapestry.ioc.internal.ConstructorServiceCreator can not access a member of class org.apache.tapestry.upload.services.MultipartDecoderImpl with modifiers "public"
      at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:88)
      at org.apache.tapestry.ioc.internal.services.PerThreadServiceCreator.initialValue(PerThreadServiceCreator.java:47)
      at java.lang.ThreadLocal$ThreadLocalMap.getAfterMiss(ThreadLocal.java:374)
      at java.lang.ThreadLocal$ThreadLocalMap.get(ThreadLocal.java:347)
      at java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:225)
      at java.lang.ThreadLocal.get(ThreadLocal.java:127)
      at org.apache.tapestry.ioc.internal.services.PerThreadServiceCreator.createObject(PerThreadServiceCreator.java:53)
      at $MultipartDecoder_117bf563559._perThreadInstance($MultipartDecoder_117bf563559.java)
      at $MultipartDecoder_117bf563559.decode($MultipartDecoder_117bf563559.java)
      at $MultipartDecoder_117bf5634bb.decode($MultipartDecoder_117bf5634bb.java)
      at org.apache.tapestry.upload.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:40)
      at $HttpServletRequestHandler_117bf5634bd.service($HttpServletRequestHandler_117bf5634bd.java)
      at $HttpServletRequestHandler_117bf5634ba.service($HttpServletRequestHandler_117bf5634ba.java)
      at org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:164)
      at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
      at org.mortbay.http.HttpServer.service(HttpServer.java:909)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
      Caused by: java.lang.RuntimeException: Error invoking constructor org.apache.tapestry.upload.services.MultipartDecoderImpl(String, int, long, long) (at MultipartDecoderImpl.java:61) (for service 'MultipartDecoder'): Class org.apache.tapestry.ioc.internal.ConstructorServiceCreator can not access a member of class org.apache.tapestry.upload.services.MultipartDecoderImpl with modifiers "public"
      at org.apache.tapestry.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:62)
      at org.apache.tapestry.ioc.internal.ServiceResourcesImpl.autobuild(ServiceResourcesImpl.java:123)
      at org.apache.tapestry.upload.services.UploadModule.buildMultipartDecoder(UploadModule.java:47)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:76)
      ... 26 more
      Caused by: java.lang.IllegalAccessException: Class org.apache.tapestry.ioc.internal.ConstructorServiceCreator can not access a member of class org.apache.tapestry.upload.services.MultipartDecoderImpl with modifiers "public"
      at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:486)
      at org.apache.tapestry.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:51)
      ... 33 more

      Tapestry should report this better, i.e., "you must make class org.apache.tapestry.upload.services.MultipartDecoderImpl public".

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Howard M. Lewis Ship
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development