0 Replies Latest reply: Oct 23, 2012 12:09 PM by 970237 RSS

    Problems with EJB injection when use Quartz and JBoss

    970237
      Hello, I need to configure a process that it execute when start the server JBoss 5.0.1. I have the next class:

      @MessageDriven(activationConfig =
      {
      @ActivationConfigProperty(propertyName="cronTrigger", propertyValue="0 0/1 * * * ?")
      })
      @ResourceAdapter("quartz-ra.rar")
      public class SincronizadorProcesosEnEspera implements Job
      {
      // @EJB(mappedName=Constants.EJB_MAPPED_FACADE_ADMINISTRADOR_LOCAL) <----------I try with this other way, and nothing
      private IAdministradorFacade administradorFacade;

      public void execute(JobExecutionContext arg0) throws JobExecutionException
      {
      // administradorFacade = (IAdministradorFacade) JNDIResources.getAdministradorFacade(); <-------------------I try with this other way, and nothing
      // administradorFacade =(IAdministradorFacade) BeanContextUtil.getBean("administradorFacade"); <------------------I try with this other way, and nothing
      administradorFacade.sincronizarProcesos();<--------- When pass for this point throw a error
      }
      }

      The error that throw the aplicattion is this:

      11:38:00,066 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound
      11:38:00,066 ERROR [JobRunShell] Job default.job.0.1351010259957 threw an unhandled Exception:
      javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound
           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:262)
           at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:270)
           at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)
           at $Proxy351.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.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound
           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:1086)
           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:145)
           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.NameNotFoundException: ejb not bound]
           at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1348)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:813)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
           at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
           at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
           ... 31 more
      Caused by: javax.naming.NameNotFoundException: ejb not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
           at javax.naming.InitialContext.lookup(InitialContext.java:392)
           at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1342)
           ... 35 more
      11:38:00,066 ERROR [ErrorLogger] Job (default.job.0.1351010259957 threw an exception.
      org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound]
           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.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound
           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:262)
           at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:270)
           at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)
           at $Proxy351.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.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera/administradorFacade into property com.integra.ppo.modelo.administrador.scheluder.SincronizadorProcesosEnEspera.administradorFacade: ejb not bound
           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:1086)
           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:145)
           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.NameNotFoundException: ejb not bound]
           at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1348)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:813)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
           at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
           at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
           ... 31 more
      Caused by: javax.naming.NameNotFoundException: ejb not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
           at javax.naming.InitialContext.lookup(InitialContext.java:392)
           at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1342)
           ... 35 more

      ---Please, help me, Only I need to execute a process with Quartz but the EJB cant be injected, The EJB is declarate in spring like this:


      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:util="http://www.springframework.org/schema/util"
           xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
      http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

      <jee:local-slsb id="administradorFacade"
                jndi-name="ModeloAdministradorEAR/AdministradorFacade/local"
                business-interface="com.integra.ppo.modelo.administrador.facade.IAdministradorFacadeLocal"
                cache-home="true" lookup-home-on-startup="true" resource-ref="true" />
      </beans>

      Thanks