Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: V3
    • Fix Version/s: V3
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: All

    • Issuezilla Id:
      10,790

      Description

      I'm trying to create a simple ConversationScope example with build 70, and a
      very simple example is giving me a NoClassDefFoundException on
      javassist.util.proxy.ProxyObject... I have made no modifications of the server,
      and the code is quite simple:

      @Stateful
      @Named
      @ConversationScoped
      public class EditUserFacade implements Serializable {
      @Inject
      private Conversation conversation;

      @Inject
      private transient UserRepository repository;

      private long userId;
      private User user;

      public void loadUser()

      { conversation.begin(); user = repository.get(userId); }

      public String editUser()

      { repository.merge(user); conversation.end(); return "viewUser?userId="+userId+"&faces-redirect=true"; }

      ...

      The full stack trace is:

      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.BeanManagerImpl.getReference(BeanManagerImpl.java:910)
      at org.jboss.weld.bean.builtin.facade.InstanceImpl.get(InstanceImpl.java:68)
      at org.jboss.weld.bean.builtin.facade.InstanceImpl.get(InstanceImpl.java:74)
      at
      org.jboss.weld.conversation.ServletConversationManager.getBeanStore(ServletConversationManager.java:60)
      at
      org.jboss.weld.conversation.AbstractConversationManager.cleanupConversation(AbstractConversationManager.java:150)
      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
      org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:111)
      at
      org.jboss.weld.conversation.ServletConversationManager_$$javassist_13.cleanupConversation(ServletConversationManager$$_javassist_13.java)
      at
      org.jboss.weld.jsf.WeldPhaseListener.afterRenderResponse(WeldPhaseListener.java:128)
      at org.jboss.weld.jsf.WeldPhaseListener.afterPhase(WeldPhaseListener.java:99)
      at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
      at
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
      at
      com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
      at
      com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:161)
      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:952)
      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.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
      at java.lang.Thread.run(Thread.java:619)
      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)
      ... 51 more
      Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
      at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
      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)
      ... 52 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:252)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      ... 59 more

        Activity

        Hide
        pmuir added a comment -

        Some notes from a discussion between Jason Greene, Jerome Dochez, Paul Sandoz,
        Roger Kitain and myself outlining the issue and possible ways forward:

        • AFAIK Javassist is not tested to run in an OSGi container (Pete)
        • Javasssit team will welcome patches for this I am sure, if you need
          introductions, please chat to me or Jason (Pete)

        Jason described this workaround that GlassFish could implement, given the
        current code:

        The classloader that holds the proxy definition should be able to see javassist.
        There are a number of ways to do that. One way would be to define proxy classes
        directly in the classloader that contains jersey. Another way would be to have a
        classloader which just holds proxies for that module.

        More specifically what I mean in the latter approach is that the glassfish
        integration code would:

        1) Construct a new classloader with the module classloader as its parent, and a
        an OSGi import that contains javassist (and any other deps). Although, you don't
        have to use OSGi for such a loader. The base loader could be OSGi, and your
        child could be some special loader, it doesn't really matter. The thing to look
        out for here, is that the proxies are in a classloader that is associated with
        the module. If you support any form of module isolation, then you can't put them
        in one global classloader (javassist classloader).

        2) This classloader is passed via classLoaderProvider as Pete recommends

        3) This classloader is then tied to the module lifecycle, such that it is
        properly cleaned.

        Jerome commented:

        It comes back to what I was suggesting. I think you need to delegate to 2
        classloaders, the module (container the base class) classloader and the
        javassist module. Santiago, you could look at DelegatingClassLoader in
        internal-api module to help you with that.

        Show
        pmuir added a comment - Some notes from a discussion between Jason Greene, Jerome Dochez, Paul Sandoz, Roger Kitain and myself outlining the issue and possible ways forward: AFAIK Javassist is not tested to run in an OSGi container (Pete) Javasssit team will welcome patches for this I am sure, if you need introductions, please chat to me or Jason (Pete) Jason described this workaround that GlassFish could implement, given the current code: The classloader that holds the proxy definition should be able to see javassist. There are a number of ways to do that. One way would be to define proxy classes directly in the classloader that contains jersey. Another way would be to have a classloader which just holds proxies for that module. More specifically what I mean in the latter approach is that the glassfish integration code would: 1) Construct a new classloader with the module classloader as its parent, and a an OSGi import that contains javassist (and any other deps). Although, you don't have to use OSGi for such a loader. The base loader could be OSGi, and your child could be some special loader, it doesn't really matter. The thing to look out for here, is that the proxies are in a classloader that is associated with the module. If you support any form of module isolation, then you can't put them in one global classloader (javassist classloader). 2) This classloader is passed via classLoaderProvider as Pete recommends 3) This classloader is then tied to the module lifecycle, such that it is properly cleaned. Jerome commented: It comes back to what I was suggesting. I think you need to delegate to 2 classloaders, the module (container the base class) classloader and the javassist module. Santiago, you could look at DelegatingClassLoader in internal-api module to help you with that.
        Hide
        Alexis MP added a comment -

        cc

        Show
        Alexis MP added a comment - cc
        Hide
        rogerk added a comment -

        Hello.
        Any chance you can attach a more complete test case (maybe a war)?
        I created a class using your code snippet (minus the application related stuff
        like UserRepository and User), included it in an existing war and was able to
        deploy without exception. I don't consider this enough to make a decision as to
        whether the problem has been addressed (I don't think it has).

        Show
        rogerk added a comment - Hello. Any chance you can attach a more complete test case (maybe a war)? I created a class using your code snippet (minus the application related stuff like UserRepository and User), included it in an existing war and was able to deploy without exception. I don't consider this enough to make a decision as to whether the problem has been addressed (I don't think it has).
        Hide
        rogerk added a comment -

        We have fxed this in the glassfish integration code and will be available in the
        next integration. I've verified the fix by including Conversations in a webapp.

        Show
        rogerk added a comment - We have fxed this in the glassfish integration code and will be available in the next integration. I've verified the fix by including Conversations in a webapp.

          People

          • Assignee:
            rogerk
            Reporter:
            mcorey
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: