1 Reply Latest reply on Dec 3, 2010 4:34 AM by Andriy Lytvynskyy

    JBOSS 5.1 / EJB3 Plugin 1.0.19 - CNFE for EJB in quartz job

    Scott Everts Newbie

      I am migrating an application from JBOSS 4.2.3 to JBOSS 5.1 and I am having a problem with our Quartz stateful jobs, we are getting ClassNotFoundException when it tries to inject one of our SLSB.  Here's what the class looks like:

       

       

      {code}@MessageDriven(activationConfig = {

              @ActivationConfigProperty(propertyName = "cronTrigger",  propertyValue = "0 0/15 * * * ?"),

              @ActivationConfigProperty(propertyName = "jobGroup",     propertyValue = "MONITOR"),

              @ActivationConfigProperty(propertyName = "jobName",      propertyValue = "MONITOR-JOB"),

              @ActivationConfigProperty(propertyName = "triggerGroup", propertyValue = "CUTOFF.MONITOR"),

              @ActivationConfigProperty(propertyName = "triggerName",  propertyValue = "CUTOFF-TRIGGER")

      })

      @ResourceAdapter("quartz-ra.rar")

      public class CutoffMonitor implements StatefulJob {

       

          private static final Logger log = Logger.getLogger(DepositCutoffMonitor.class);

       

       

          @PersistenceContext (unitName="ATMEntityPU")

          private EntityManager em;

       

          @EJB

          private SystemStatus systemStatus;

       

          public void execute(JobExecutionContext context) throws JobExecutionException {

              String jobName = context.getJobDetail().getName();

              String groupName = context.getJobDetail().getGroup();

       

              log.debug("Executing job: " + jobName + " executing at " + new Date() + " -- " + hashCode());

          }

      }

      {code}

       

       

      The Quartz stateful job and the EJB live in the same JAR which is then packaged into an EAR.

       

      When the Quartz job fires we get the following set of exceptions:

       

       

      {quote}

      13:45:00,102 ERROR [ErrorLogger] Job (CUTOFF.MONITOR.CUTOFF-JOB threw an exception.
      org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler@4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler@20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]]  delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}}]
          at org.quartz.core.JobRunShell.run(JobRunShell.java:214)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      * Nested Exception (Underlying Cause) ---------------
      javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler@4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler@20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]]  delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <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:299)
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152)
          at $Proxy366.execute(Unknown Source)
          at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler@4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler@20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]]  delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <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)
          at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:83)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:74)
          at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1138)
          at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83)
          at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73)
          at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:146)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
          ... 17 more
      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@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-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)
          ... 31 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@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-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)
          ... 35 more
      Caused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/}
          at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:410)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134)
          at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
          at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)
          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)
          ... 39 more
      Caused by: java.lang.ClassNotFoundException: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler@4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler@20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]]  delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}}
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:247)
          at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:406)
          ... 45 more

      {quote}

       

      We are using the "Default" configuration and therefore the the "isolated" flag is already set to false.  Has anyone figured out how to work around this issue?  I am stuck on this an have not figured out how to move past it.

       

      Thanks,

       

      Scott