Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-600

Unable to deserialize Javassist proxy due to wrong classloader being used

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: None
    • Fix Version/s: TBC
    • Labels:
      None
    • Environment:
      Apache Tomcat 6.0.20

      Description

      Trying to mark a conversation as long-running causes an exception (java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject) when the ServletConversationManager tries to get a proxy for the httpSession.
      The ProxyFactory.classLoaderProvider ends up resolving the classloader to an instance of org.apache.catalina.loader.StandardClassLoader (which doesn't know the javassist lib, since it's only in the app classloader).

        Gliffy Diagrams

        1. Action.java
          0.9 kB
          Fabio Wang
        2. action.xhtml
          0.8 kB
          Fabio Wang
        3. Bean.java
          0.3 kB
          Fabio Wang
        4. template.xhtml
          0.8 kB
          Fabio Wang

          Issue Links

            Activity

            Hide
            sandoz Paul Sandoz added a comment -

            I am observing a similar exception when attempting to use Weld integrated into GlassFish. I am not sure if the cause is exactly the same but it still might be useful information.

            Glassfish's JAX-RS implementation, Jersey, needs to use a 299 Extension implementation such that the InjectionTarget of ProcessInjectTarget events can be adapted thus enabling JAX-RS artifacts to be injected.

            If you copy the attached jersey-gf-bundle.jar into current nightly build of GF [1] to the location:

            glassfish/modules/jersey-gf-bundle.jar

            start GlassFish then deploy a simple 299 enabled web app you should see the following exception in the server.log when it attempts to create a client proxy to the Extension class:

            WARNING: Exception while dispatching an event
            org.jboss.weld.DefinitionException: org.jboss.weld.DefinitionException: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
            at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:43)
            at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:40)
            at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:270)
            at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:135)
            at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:88)
            at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:228)
            at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:314)
            at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:169)
            at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1159)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1218)
            at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1207)
            at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:362)
            at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:201)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
            at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
            at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:241)
            at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:789)
            at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:697)
            at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:951)
            at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:166)
            at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
            at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
            at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
            at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
            at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
            at com.sun.grizzly.util.FixedThreadPool$BasicWorker.doWork(FixedThreadPool.java:431)
            at com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:410)
            at java.lang.Thread.run(Thread.java:637)
            Caused by: org.jboss.weld.DefinitionException: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
            at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:51)
            at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:39)
            ... 33 more
            Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
            at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:344)
            at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:314)
            at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:273)
            at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:84)
            at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:41)
            at org.jboss.weld.bean.proxy.ClientProxyProvider$1.call(ClientProxyProvider.java:122)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at org.jboss.weld.util.collections.ConcurrentCache.putIfAbsent(ConcurrentCache.java:125)
            at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:112)
            at org.jboss.weld.BeanManagerImpl.getReference(BeanManagerImpl.java:890)
            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:215)
            at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:196)
            at org.jboss.weld.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:844)
            at org.jboss.weld.BeanManagerImpl.fireEvent(BeanManagerImpl.java:837)
            at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:47)
            ... 34 more
            Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
            at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)
            at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:339)
            ... 49 more
            Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:703)
            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:597)
            at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
            at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)
            ... 50 more
            Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.ProxyObject
            at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:738)
            at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
            at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:402)
            ... 58 more

            A workaround is to add the following to the Import-Package header of the MANIFEST.MF:

            javassist.util.proxy;resolution:=optional;version="3.8"

            Note that this error only occurs for the Extension implementation class in the jersey-gf-bundle.jar and does not occur for other 299 managed beans declared in a web app.

            Such a declaration should not be required as there is no direct dependency on that package. It is not clear to me if this is a class loading issue with Weld or a class loading issue with GlassFish's OSGi container, or a combination of both.

            Unfortunately i cannot create a more isolated test case.

            [1] http://download.java.net/glassfish/v3/nightly/

            Show
            sandoz Paul Sandoz added a comment - I am observing a similar exception when attempting to use Weld integrated into GlassFish. I am not sure if the cause is exactly the same but it still might be useful information. Glassfish's JAX-RS implementation, Jersey, needs to use a 299 Extension implementation such that the InjectionTarget of ProcessInjectTarget events can be adapted thus enabling JAX-RS artifacts to be injected. If you copy the attached jersey-gf-bundle.jar into current nightly build of GF [1] to the location: glassfish/modules/jersey-gf-bundle.jar start GlassFish then deploy a simple 299 enabled web app you should see the following exception in the server.log when it attempts to create a client proxy to the Extension class: WARNING: Exception while dispatching an event org.jboss.weld.DefinitionException: org.jboss.weld.DefinitionException: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:43) at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:40) at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:270) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:135) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:88) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:228) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:314) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:169) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1159) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1218) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1207) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:362) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:201) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:241) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:789) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:697) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:951) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:166) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.FixedThreadPool$BasicWorker.doWork(FixedThreadPool.java:431) at com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:410) at java.lang.Thread.run(Thread.java:637) Caused by: org.jboss.weld.DefinitionException: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:51) at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:39) ... 33 more Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:344) at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:314) at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:273) at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:84) at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:41) at org.jboss.weld.bean.proxy.ClientProxyProvider$1.call(ClientProxyProvider.java:122) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at org.jboss.weld.util.collections.ConcurrentCache.putIfAbsent(ConcurrentCache.java:125) at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:112) at org.jboss.weld.BeanManagerImpl.getReference(BeanManagerImpl.java:890) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:215) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:196) at org.jboss.weld.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:844) at org.jboss.weld.BeanManagerImpl.fireEvent(BeanManagerImpl.java:837) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:47) ... 34 more Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169) at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:339) ... 49 more Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:703) 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:597) at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181) at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163) ... 50 more Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.ProxyObject at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:738) at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60) at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650) at java.lang.ClassLoader.loadClass(ClassLoader.java:254) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:402) ... 58 more A workaround is to add the following to the Import-Package header of the MANIFEST.MF: javassist.util.proxy;resolution:=optional;version="3.8" Note that this error only occurs for the Extension implementation class in the jersey-gf-bundle.jar and does not occur for other 299 managed beans declared in a web app. Such a declaration should not be required as there is no direct dependency on that package. It is not clear to me if this is a class loading issue with Weld or a class loading issue with GlassFish's OSGi container, or a combination of both. Unfortunately i cannot create a more isolated test case. [1] http://download.java.net/glassfish/v3/nightly/
            Hide
            luxspes Francisco Jose Peredo Noguez added a comment -
            Show
            luxspes Francisco Jose Peredo Noguez added a comment - I might have just hit this bug (or a very similar one?): Read http://www.seamframework.org/Community/HowToReachHttpServletRequestAndHttpServletResponseFromBean
            Hide
            pmuir Pete Muir added a comment -

            Francisco please create a new issue, explain step by step how to reproduce and attach relevant sources, and link to this as related.

            Show
            pmuir Pete Muir added a comment - Francisco please create a new issue, explain step by step how to reproduce and attach relevant sources, and link to this as related.
            Hide
            pmuir Pete Muir added a comment -

            Can confirm this is no longer a problem.

            Show
            pmuir Pete Muir added a comment - Can confirm this is no longer a problem.
            Hide
            pmuir Pete Muir added a comment -

            As this is working with a manual test, and I can't write a test with embedded TC (which is all Arquillian supports right now), I'm descheduling.

            To be clear this issue has been fixed, the issue is simply open to remind us to add a test when we can.

            Show
            pmuir Pete Muir added a comment - As this is working with a manual test, and I can't write a test with embedded TC (which is all Arquillian supports right now), I'm descheduling. To be clear this issue has been fixed, the issue is simply open to remind us to add a test when we can.

              People

              • Assignee:
                Unassigned
                Reporter:
                fabiowg Fabio Wang
              • Votes:
                4 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development