[jboss-user] [Beginner's Corner] - Dependency injection fails after hot-redeploy

andresee do-not-reply at jboss.com
Fri Nov 20 09:04:13 EST 2009


I have tried looking for answers to my problem and found http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155732 and the like. I find similar problems, but no answers.

I am invoking a MessageBean by quartz (using the quartz-ra.rar shipping with JBoss AS 5.1.0) which then gets a SessionsBean via dependency injection.

To compile and deploy I am using Eclipse, building for the target environment JBoss 5.1.0 (using the local deployer option). Everything is deployed in a .jar folder in /server/deploy.

This works very well, when I deploy one time only. As soon as I "touch" the ejb-jar.xml to get JBoss to redeploy, I get errors and my application stops working. Note that when I am touching the ejb-jar.xml, I haven't changed anything in the jar at all.

As far as I understand it (I am trying to figure out JBoss for 2 weeks now), the classloader still holds the classes of the first deployment somewhere and insists that these do not match the ones of the second deployment.

Output says "failed to set value Proxy to ... Reason: ClassLoaders of value and target are not equal" when trying the dependency injection.

Does anyone know how I could fix this? (FAQ and documentation didn't help me, but if a simple RTFM helps in my case I would be glad as well)

@ResourceAdapter("quartz-ra.rar")
  | @MessageDriven(activationConfig =
  | {@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0/2 * * * * ?")})
  | public class StarterBean implements Job 
  | {
  | 	private static final Logger log = Logger.getLogger(StarterBean.class);
  | 
  | 	@EJB
  | 	private DispatcherBeanLocal dispatcher;
  | 	
  | 	/**
  | 	 * Default constructor. 
  | 	 */
  | 	public StarterBean() {
  | 	}
  | 
  | 	/**
  | 	 * @see Job#execute(JobExecutionContext)
  | 	 */
  | 	public void execute(JobExecutionContext jobExecutionContext)  throws JobExecutionException
  | 	{
  | 		StarterBean.log.info("************** JOB: " + jobExecutionContext.getJobDetail().getName());
  | 		dispatcher.execute();
  | 		StarterBean.log.info("******* END OF JOB: " + jobExecutionContext.getJobDetail().getName());
  | 	}
  | 
  | }


  | @Stateless
  | public class DispatcherBean implements DispatcherBeanLocal 
  | {
  | 	
  |     public DispatcherBean() {
  |     }
  | 
  | 	public void execute() {
  | 		
  | 		System.out.println("Dispatch.");
  | 	}
  | 
  | }


org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: javax.ejb.EJBTransactionRolledbackException: failed to inject Proxy 
  | 
  | to jboss.j2ee:jar=GDBUpdate.jar,name=DispatcherBean,service=EJB3 implementing [interface com.sag.gdbu.dispatcher.DispatcherBeanLocal] (implements [interface 
  | 
  | com.sag.gdbu.dispatcher.DispatcherBeanLocal]) from env/com.sag.gdbu.starter.StarterBean/dispatcher (link -> gdbu/dispatcher/local) into 
  | 
  | com.sag.gdbu.starter.StarterBean.dispatcher of com.sag.gdbu.starter.StarterBean at 371bda]
  |         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: failed to inject Proxy to jboss.j2ee:jar=GDBUpdate.jar,name=DispatcherBean,service=EJB3 implementing [interface 
  | 
  | com.sag.gdbu.dispatcher.DispatcherBeanLocal] (implements [interface com.sag.gdbu.dispatcher.DispatcherBeanLocal]) from 
  | 
  | env/com.sag.gdbu.starter.StarterBean/dispatcher (link -> gdbu/dispatcher/local) into com.sag.gdbu.starter.StarterBean.dispatcher of 
  | 
  | com.sag.gdbu.starter.StarterBean at 371bda
  |         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 $Proxy275.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.IllegalArgumentException: failed to inject Proxy to jboss.j2ee:jar=GDBUpdate.jar,name=DispatcherBean,service=EJB3 implementing 
  | 
  | [interface com.sag.gdbu.dispatcher.DispatcherBeanLocal] (implements [interface com.sag.gdbu.dispatcher.DispatcherBeanLocal]) from 
  | 
  | env/com.sag.gdbu.starter.StarterBean/dispatcher (link -> gdbu/dispatcher/local) into com.sag.gdbu.starter.StarterBean.dispatcher of 
  | 
  | com.sag.gdbu.starter.StarterBean at 371bda
  |         at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:139)
  |         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: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: java.lang.IllegalArgumentException: failed to set value Proxy to jboss.j2ee:jar=GDBUpdate.jar,name=DispatcherBean,service=EJB3 implementing 
  | 
  | [interface com.sag.gdbu.dispatcher.DispatcherBeanLocal] on field private com.sag.gdbu.dispatcher.DispatcherBeanLocal 
  | 
  | com.sag.gdbu.starter.StarterBean.dispatcher; Reason:
  |  ClassLoaders of value and target are not equal
  |         at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:100)
  |         at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:119)
  |         ... 30 more
  | 14:25:42,695 INFO  [EJBContainer] STOPPED EJB: com.sag.gdbu.starter.StarterBeanejbName: GDBStarter
  | 14:25:42,711 INFO  [EJBContainer] STOPPED EJB: com.sag.gdbu.starter.StarterBeanejbName: StarterBean
  | 14:25:43,305 INFO  [SessionSpecContainer] Stopping jboss.j2ee:jar=GDBUpdate.jar,name=DispatcherBean,service=EJB3
  | 14:25:43,320 INFO  [EJBContainer] STOPPED EJB: com.sag.gdbu.dispatcher.DispatcherBean ejbName: DispatcherBean

Changing the code to use jndi lookup by hand doesn't solve the problem.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266761#4266761

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266761



More information about the jboss-user mailing list