[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

rmcalderero do-not-reply at jboss.com
Mon Feb 11 06:42:36 EST 2008


I tried adding manually the dependency on the entity manager in the listener class, but got the same exception...

In component:
@Name("servicioResultados")
  | @Scope(APPLICATION)
  | @Startup(depends={"em"})
  | public class ServicioResultados implements MessageListener {
  | .....

The exception:

  | 12:17:22,567 DEBUG [ServicioResultados] Se ejecuta el Servicio de Resultados: Nuevo mensaje......
  | 12:17:22,567 WARN  [ActiveMQMessageConsumer] Exception while processing message: java.lang.NullPointerException
  | java.lang.NullPointerException
  | 	at org.fundacionctic.tawmonitor.servicios.ServicioResultados.onMessage(ServicioResultados.java:113)
  | 	at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:854)
  | 	at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:99)
  | 	at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:166)
  | 	at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:117)
  | 	at org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)
  | 	at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
  | 	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
  | 	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
  | 	at java.lang.Thread.run(Unknown Source)
  | 
  | 

The strange thing about this is that in an asynchronous method (configured with quartz) of other component (also application scoped), we read from db with the em and we send a message to the queue. And its working ok. However the listener method of our serviceReader component is not receiving the entity manager when executed. So i also think it has something to do with the way Seam manages MessageListener components (at least in a non EJB enviroment).

We also tried to move the inicialization of our servicioResultados component to a method observing the seam postInitialization event:

	@Observer("org.jboss.seam.postInitialization")
  | 	public void postInitialization() {
  | 		
  | 		servicioResultados.config();
  |                 .......
  | 
But again the same problem.

I think this is a quite typical scenario, so i hope someone can give some insight on this issue.


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

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



More information about the jboss-user mailing list