-
15. Re: onMessage() is not invoked in JBoss 7.1.1
sfcoy Jul 3, 2012 3:22 AM (in response to ohmygod)1 of 1 people found this helpfulIt looks like you're missing:
{code:xml} <subsystem xmlns="urn:jboss:domain:ejb3:1.2">
...
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
...
{code}
-
16. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 3:33 AM (in response to sfcoy)No, stephen, it is there at line 116..
-
17. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 3:36 AM (in response to ohmygod)oh, sorry, really missed
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb> -
18. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 3:42 AM (in response to ohmygod)Added the piece of item and now got these repeated errors:
15:38:25,147 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] (Thread-8 (HornetQ-client-global-threads-2005099813)) Failed to deliver message: java.lang.reflect.UndeclaredThrowableException at $Proxy13.onMessage(Unknown Source) at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278) at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:983) at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48) at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1113) at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07] Caused by: java.lang.Exception: java.lang.NoClassDefFoundError: Could not initialize class com.demo.testMDB at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:75) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:184) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at javax.jms.MessageListener$$$view1.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final.jar:1.0.0.Final] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_07] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_07] at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_07] at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
-
19. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 3:45 AM (in response to ohmygod)It seems classes cannot be found any more if myapp.jar is put in the root of EAR.
-
20. Re: onMessage() is not invoked in JBoss 7.1.1
sfcoy Jul 3, 2012 4:08 AM (in response to ohmygod)I doubt that.
I suspect you have missing library classes, such as log4j or similar.
Can you show the source for
com.demo.testMDB
? -
21. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 4:16 AM (in response to sfcoy)I just removed some temp files under standalone foler (data folder and tmp folder) and this classnotfound error is missing. Now I am having this one:
Caused by: javax.ejb.EJBException: Could not create MDB: com.demo.jms.QueueConnectionFactory -- service jboss.naming.context.java."com.demo.jms.QueueConnectionFactory" at com.demo.everest.util.jms.GenericQueueMDB.ejbCreate(GenericQueueMDB.java:116) [demo.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_07] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_07] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_07] at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_07] at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.messagedriven.MessageDrivenBeanSetMessageDrivenContextInterceptor.processInvocation(MessageDrivenBeanSetMessageDrivenContextInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] ... 41 more 16:08:46,374 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] (Thread-4 (HornetQ-client-global-threads-1850831016)) Failed to deliver message: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.create(MessageDrivenComponent.java:79) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.create(MessageDrivenComponent.java:76) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.pool.AbstractPool.create(AbstractPool.java:60) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:123) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
What confuses me is I have already modifed the factory name in the code to "RemoteConnectionFactory" which mapps to the configuration set in standalone.xml
<connection-factory name="RemoteConnectionFactory"> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="RemoteConnectionFactory"/> <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/> </entries> </connection-factory>
That is why I am trying to clean the temp files and see if some temp file remembers the old factory name. However, it is still not working.
-
22. Re: onMessage() is not invoked in JBoss 7.1.1
sfcoy Jul 3, 2012 4:46 AM (in response to ohmygod)Show us the source for com.demo.everest.util.jms.GenericQueueMDB.
-
23. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 5:16 AM (in response to sfcoy)I omitted the package and import part
public abstract class GenericQueueMDB implements MessageDrivenBean, MessageListener { protected MessageDrivenContext m_messageDrivenContext; protected QueueConnectionFactory m_queueConnectionFactory; protected QueueConnection m_queueConnection; protected Context m_initialContext; /** * Activates the EJB */ public void ejbActivate() { try { m_queueConnection = m_queueConnectionFactory.createQueueConnection(); m_queueConnection.start(); } catch (Exception e) { } } /** * Called when the EJB is removed. * */ public void ejbRemove() {} /** * Called when the EJB is made passive. * */ public void ejbPassivate() { try { m_queueConnection.close(); } catch (Exception e) { } } /** * Sets the session context. * * @param ctx MessageDrivenContext Context for session */ public void setMessageDrivenContext(MessageDrivenContext ctx) { m_messageDrivenContext = ctx; } /** * Creates the EJB */ public void ejbCreate () { try{ m_initialContext = new InitialContext(); m_queueConnectionFactory = (QueueConnectionFactory) m_initialContext.lookup(AnotherClass.FATCORY_NAME); } catch (Exception e) { } } /** * Does whatever the MDB should do when receiving a message from JMS. * * @param p_message - JMS Message */ public abstract void onMessage(Message p_message); }
消息编辑者为:mike just
-
24. Re: onMessage() is not invoked in JBoss 7.1.1
sfcoy Jul 3, 2012 4:57 AM (in response to ohmygod)Are there ejb-jar.xml and jboss-ejb3.xml (formerly jboss.xml) files to go with this?
-
25. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 4:59 AM (in response to sfcoy)No. Need them?
-
26. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 5:02 AM (in response to ohmygod)It is very strange. When the factory names are consistent between the code and standalone.xml, this error will happen. When I changed either one, there will be the factory cannot be found error, which makes sense.
Caused by: javax.ejb.EJBException: Could not create MDB: com.demo.jms.QueueConnectionFactory -- service jboss.naming.context.java."com.demo.jms.QueueConnectionFactory" at com.demo.everest.util.jms.GenericQueueMDB.ejbCreate(GenericQueueMDB.java:116) [demo.jar:]
I do not know where this old factory name is remembered..
-
27. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 5:15 AM (in response to ohmygod)Just a note that, actually in the class, the parameter is using a final static String FACTORY_NAME instead of the string "RemoteConnectionFactory". I just changed AnotherClass.FATCORY_NAME to "RemoteConnectionFactory" and found it works!
m_queueConnectionFactory = (QueueConnectionFactory) m_initialContext.lookup(AnotherClass.FATCORY_NAME); . . . public static final String FATCORY_NAME = "RemoteConnectionFactory";
So, what is the root cause? Why the static string cannot be updated to the new value?
-
28. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 5:27 AM (in response to ohmygod)I just changed
FATCORY_NAME
to "GSRemoteConnectionFactory
" and the parameter still usesAnotherClass.FATCORY_NAME
and it works again.. But when I changed them both back to "RemoteConnectionFactory". Error comes becoming "
GS
RemoteConnectionFactory" cannot be found. So I doubt there is somewhere cached the previous factory name. But I donot know where it is..
-
29. Re: onMessage() is not invoked in JBoss 7.1.1
ohmygod Jul 3, 2012 5:33 AM (in response to ohmygod)To walk around this, I added a new entry and use "JMSConnectionFactory" as the static name and found it is working fine. So maybe the original name "RemoteConnectionFactory" has a bug or something? I am not sure.
<entry name="JMSConnectionFactory"/> <entry name="java:jboss/exported/jms/JMSConnectionFactory"/>
Thanks again Stephen for your advise and patience for this issue. I think I can use this walk around if there is no more evidence to prove what the root cause is for this problem.