Hi, I have tried to setup it following the examples, but just not working for me. Here are some codes:
1) No annotation in mdb , just a onMessage method. The ejb-jar.xml: <enterprise-beans> <message-driven> <ejb-name>StandardReportsBean</ejb-name> <ejb-class>se.it.newjena.reports.bean.receivers.StandardReportsBean</ejb-class> <messaging-type>javax.jms.MessageListener</messaging-type> <activation-config> <activation-config-property> <activation-config-property-name>destination</activation-config-property-name> <activation-config-property-value>ReportStandardJMSQueue</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>destinationType</activation-config-property-name> <activation-config-property-value>javax.jms.Queue</activation-config-property-value> </activation-config-property> </activation-config> <resource-ref> <res-ref-name>jms/tdm-newjena/ReportStandardJMSConnFactory</res-ref-name> <res-type>javax.jms.ConnectionFactory</res-type> </resource-ref> <resource-ref> <res-ref-name>ReportStandardJMSQueue</res-ref-name> <res-type>javax.jms.Queue</res-type> </resource-ref> </message-driven> </enterprise-beans> 2) The resources in the server.xml for tomcat in Eclipse: <Resource auth="Container" description="Report Standard JMSQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="ReportStandardJMSQueue" physicalName="ReportStandardJMSQueue" type="org.apache.activemq.command.ActiveMQQueue"/> <Resource auth="Container" brokerName="LocalActiveMQBroker" brokerURL="tcp://localhost:61616" description="Report Standard JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="jms/tdm-newjena/ReportStandardJMSConnFactory" type="org.apache.activemq.ActiveMQConnectionFactory"/> <Context docBase="C:\JavaDev\tools\apache-tomcat-6.0.29\webapps\openejb" path="/openejb" reloadable="true"/> 3) The code to send message: QueueConnection queueConnection = null; QueueSession queueSession = null; Queue queue = null; QueueSender queueSender = null; ObjectMessage message = null; try { // check if jndiContext and queueConnectionFactory are set if not // throw an exception if (jndiContext == null || queueConnectionFactory == null) throw new Exception("InitialContext or QueueConnectionFactory is not set"); /* * Look up queue. */ queue = (Queue) jndiContext.lookup("ReportStandardJMSQueue"); queueConnection = queueConnectionFactory.createQueueConnection(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueSender = queueSession.createSender(queue); /* * Send message */ message = queueSession.createObjectMessage(); message.setObject(wrapper); queueSender.send(message); logger.info("Jena reports - a message has been sent"); } I also tried the below in ejb-jar.xml, but it will say the queue has binded to context, and if I removed the resource for this queue in server.xml, then it can't find the queue for sending messages. <resource-env-ref> <resource-env-ref-name>ReportStandardJMSQueue</resource-env-ref-name> <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type> </resource-env-ref> Best Regards, Johnny Guo VIT Tianjin Mobile: +86 13682195826 E-mail: qiang....@consultant.volvo.com From: Romain Manni-Bucau [via OpenEJB] [mailto:ml-node+s979440n4548744...@n4.nabble.com] Sent: Wednesday, April 11, 2012 8:23 PM To: Guo Qiang (Consultant) Subject: Re: MDB not invoked Hi, how did you configure: 1) the mdb 2) the jmx resources (queue, connection factory, ...) 3) the client ? it sounds like a config error. If you can share some code we could help you more efficiently. Note: some JMS sample are here: http://openejb.apache.org/examples-trunk/index.html - Romain 2012/4/11 Johnny Guo <[hidden email]</user/SendEmail.jtp?type=node&node=4548744&i=0>> > Hi, > > I'm new to openejb. Now i'm working with openejb integrated with Tomcat in > Eclipse. Openejb can start successfully. One MDB was setup to listen to a > jms queue and the start log like this: > [INFO] Found ejb module EjbModule in war /newjena > [INFO] Found ejb module EjbModule in war /newjena > [INFO] Configuring enterprise application: > > C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena > [INFO] Auto-linking resource-ref > 'jms/tdm-newjena/ReportStandardJMSConnFactory' in bean StandardReportsBean > to Resource(id=jms/tdm-newjena/ReportStandardJMSConnFactory) > [INFO] Auto-linking resource-ref 'jms/tdm-newjena/ReportStandardJMSQueue' > in > bean StandardReportsBean to > Resource(id=jms/tdm-newjena/ReportStandardJMSQueue) > [INFO] Configuring Service(id=jms/tdm-newjena/ReportStandardJMSQueue, > type=Resource, provider-id=Default Queue) > [INFO] Auto-creating a Resource with id > 'jms/tdm-newjena/ReportStandardJMSQueue' of type 'javax.jms.Queue for > 'StandardReportsBean'. > [INFO] Creating Resource(id=jms/tdm-newjena/ReportStandardJMSQueue) > [INFO] Enterprise application > > "C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena" > loaded. > [INFO] Assembling app: > > C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena > [INFO] Jndi(name=StandardReportsBean) --> > Ejb(deployment-id=StandardReportsBean) > [INFO] Created Ejb(deployment-id=StandardReportsBean, > ejb-name=StandardReportsBean, container=My MDB Container) > > But when the message is sent to the queue, the MDB can not be invoked. > What > is the problem and how can i get more detail information if something like > this happens? > Thanks > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548110.html > Sent from the OpenEJB User mailing list archive at Nabble.com. > ________________________________ If you reply to this email, your message will be added to the discussion below: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548744.html To unsubscribe from MDB not invoked, click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4548110&code=cWlhbmcuZ3VvQGNvbnN1bHRhbnQudm9sdm8uY29tfDQ1NDgxMTB8LTQ0OTE1ODIzNQ==>. NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4550730.html Sent from the OpenEJB User mailing list archive at Nabble.com.