5 Replies Latest reply on Oct 14, 2009 1:18 AM by jaikiran pai

    ClassnotFoundException on @EJB on a MDB

    Pieter Martin Novice

      Hi,

      I am using jboss-5.1.0.GA. If I use the the default jboss-messaging then the MDB works fine.

      However if I use the hornetq with the default-with-hornetq profile I am unable to inject the a stateless EJB and get the following exception

      javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.rorotika.ns.test.jms.NotificationServiceMDB/notificationServiceMasterProcess into property com.rorotika.ns.test.jms.NotificationServiceMDB.notificationServiceMasterProcess: com.rorotika.ns.jbpm.NotificationServiceMasterProcess from BaseClassLoader@1f957352{VFSClassLoaderPolicy@cc61cb1{name=vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/ domain=ClassLoaderDomain@6fe30af{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@790bc49d} roots=[MemoryContextHandler@579186436[path= context=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v real=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v], FileHandler@1990541648[path=jms-ra.rar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/], DelegatingHandler@1533224970[path=jms-ra.rar/hornetq-core-client.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-core-client.jar], DelegatingHandler@1255790437[path=jms-ra.rar/hornetq-jms.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-jms.jar], DelegatingHandler@600591943[path=jms-ra.rar/hornetq-ra.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-ra.jar]] delegates=null exported=[, org.hornetq.utils.json, org.hornetq.jms.bridge, org.hornetq.core.list.impl, org.hornetq.core.message.impl, org.hornetq.core.remoting.impl, org.hornetq.core.config.impl, org.hornetq.core.exception, org.hornetq.ra, schema, org.hornetq.core.version.impl, org.hornetq.core.cluster.impl, org.hornetq.core.filter.impl, org.hornetq.utils.concurrent, org.hornetq.core.config.cluster, org.hornetq.core.message, org.hornetq.core.logging, org.hornetq.core.server, org.hornetq.core.version, org.hornetq.jms.server, org.hornetq.core.client.management.impl, org.hornetq.core.management.impl, org.hornetq.core.list, org.hornetq.core.remoting.server.impl, org.hornetq.jms.referenceable, org.hornetq.utils, org.hornetq.jms, org.hornetq.core.remoting.spi, org.hornetq.core.buffers, org.hornetq.core.client, org.hornetq.jms.bridge.impl, org.hornetq.jms.server.impl, org.hornetq.jms.client, org.hornetq.jms.server.recovery, org.hornetq.core.remoting.impl.invm, org.hornetq.jms.server.management, org.hornetq.core.remoting.impl.wireformat.replication, org.hornetq.core.cluster, org.hornetq.core.filter, org.hornetq.core.remoting.impl.wireformat, org.hornetq.core.journal, org.hornetq.jms.server.management.impl, org.hornetq.core.remoting, org.hornetq.jms.server.management.jmx.impl, org.hornetq.core.config, META-INF, org.hornetq.core.remoting.impl.ssl, org.hornetq.ra.inflow, org.hornetq.core.management.jmx.impl, org.hornetq.core.client.impl, org.hornetq.core.remoting.server, org.hornetq.core.management] <IMPORT-ALL>NON_EMPTY}}
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:80)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:282)
       at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:270)
       at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)
       at $Proxy367.onMessage(Unknown Source)
       at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:243)
       at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:664)
       at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:42)
       at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:780)
      
      
      ...
      
      Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.rorotika.ns.test.jms.NotificationServiceMDB/notificationServiceMasterProcess into property com.rorotika.ns.test.jms.NotificationServiceMDB.notificationServiceMasterProcess: com.rorotika.ns.jbpm.NotificationServiceMasterProcess from BaseClassLoader@1f957352{VFSClassLoaderPolicy@cc61cb1{name=vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/ domain=ClassLoaderDomain@6fe30af{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@790bc49d} roots=[MemoryContextHandler@579186436[path= context=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v real=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v], FileHandler@1990541648[path=jms-ra.rar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/], DelegatingHandler@1533224970[path=jms-ra.rar/hornetq-core-client.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-core-client.jar], DelegatingHandler@1255790437[path=jms-ra.rar/hornetq-jms.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-jms.jar], DelegatingHandler@600591943[path=jms-ra.rar/hornetq-ra.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-ra.jar]] delegates=null exported=[, org.hornetq.utils.json, org.hornetq.jms.bridge, org.hornetq.core.list.impl, org.hornetq.core.message.impl, org.hornetq.core.remoting.impl, org.hornetq.core.config.impl, org.hornetq.core.exception, org.hornetq.ra, schema, org.hornetq.core.version.impl, org.hornetq.core.cluster.impl, org.hornetq.core.filter.impl, org.hornetq.utils.concurrent, org.hornetq.core.config.cluster, org.hornetq.core.message, org.hornetq.core.logging, org.hornetq.core.server, org.hornetq.core.version, org.hornetq.jms.server, org.hornetq.core.client.management.impl, org.hornetq.core.management.impl, org.hornetq.core.list, org.hornetq.core.remoting.server.impl, org.hornetq.jms.referenceable, org.hornetq.utils, org.hornetq.jms, org.hornetq.core.remoting.spi, org.hornetq.core.buffers, org.hornetq.core.client, org.hornetq.jms.bridge.impl, org.hornetq.jms.server.impl, org.hornetq.jms.client, org.hornetq.jms.server.recovery, org.hornetq.core.remoting.impl.invm, org.hornetq.jms.server.management, org.hornetq.core.remoting.impl.wireformat.replication, org.hornetq.core.cluster, org.hornetq.core.filter, org.hornetq.core.remoting.impl.wireformat, org.hornetq.core.journal, org.hornetq.jms.server.management.impl, org.hornetq.core.remoting, org.hornetq.jms.server.management.jmx.impl, org.hornetq.core.config, META-INF, org.hornetq.core.remoting.impl.ssl, org.hornetq.ra.inflow, org.hornetq.core.management.jmx.impl, org.hornetq.core.client.impl, org.hornetq.core.remoting.server, org.hornetq.core.management] <IMPORT-ALL>NON_EMPTY}}
       at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)
       at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
       at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
       at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)
       at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:89)
      
      
      ...
      
      Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@1f957352{vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/}]]
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1352)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:817)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
       at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
       at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
       ... 36 more
      Caused by: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@1f957352{vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/}]
       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1346)
       ... 40 more
      Caused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@1f957352{vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/}
       at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:343)
       at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134)
       at org.jboss.ejb3.proxy.impl.objectfactory.session.stateful.StatefulSessionProxyObjectFactory.getProxy(StatefulSessionProxyObjectFactory.java:64)
       at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:158)
       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
       at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
       ... 44 more
      Caused by: java.lang.ClassNotFoundException: com.rorotika.ns.jbpm.NotificationServiceMasterProcess from BaseClassLoader@1f957352{VFSClassLoaderPolicy@cc61cb1{name=vfsfile:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/ domain=ClassLoaderDomain@6fe30af{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@790bc49d} roots=[MemoryContextHandler@579186436[path= context=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v real=vfsmemory://3j011-iijrs-g0qf5n0g-1-g0qf5zuc-1v], FileHandler@1990541648[path=jms-ra.rar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/], DelegatingHandler@1533224970[path=jms-ra.rar/hornetq-core-client.jar context=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/ real=file:/home/pieter/jboss-5.1.0.GA/server/default-with-hornetq/deploy/jms-ra.rar/hornetq-core-client.jar], DelegatingHandler@1255790437[path=jms-ra.rar/hornetq-jms.jar
      
      ...
      
      



      My MDB is as follows

      @MessageDriven(name = "NotificationServiceMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
       @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/TextQueue") })
      @Name("notificationServiceMDB")
      public class NotificationServiceMDB implements MessageListener {
       @EJB
       private NotificationServiceMasterProcess notificationServiceMasterProcess;
       public void onMessage(Message arg0) {
       TextMessage message = (TextMessage)arg0;
       try {
       notificationServiceMasterProcess.setProcessDefinitionName(message.getText());
       } catch (JMSException e) {
       throw new RuntimeException(e);
       }
       notificationServiceMasterProcess.start();
       }
      }
      


      Is this a bug or am I doing something wrong?

      It looks to me like a classloader issue.

      Thanks
      Pieter