Re: Message Driven Bean is not receiving messages
Hi everyone, I think I got it. The queue's name was different from its physical name and the geronimo activemq environment was kind of trashed - so I reinstalled geronimo and changed the names such that they match. It seems to work now. So I had two problems: 1. Geronimo did not clean up the existing queues if the rar is uninstalled in the webfrontend (using the J2EE Connectors module). Is there any additional step needed to also clean up the mbeans of these queues? (Somehow related: Why isn't it possible to edit the JMS Resources?) 2. The name and the physical names of the queues have to match. If they don't the EJB will consume the messages of the queue named like the name and thus not receiving the messages from the producer which will happily enqueue messages into a queue named like the physical name of the queue. Is this a bug or did I again do something wrong in the declaration where to drop the messages? Both problems can be seen with JConsole. Best, Stephan On Wed, Aug 26, 2009 at 10:26, Stephan Mehlhases.mehlh...@googlemail.com wrote: Hi, Okay, so I tried the Example from the documentation. It works out of the box. I then tried to change to the message queue I created and it stopped working - so I guess something is wrong there. So here is the deployment plan of the JMS Resources I created: ?xml version=1.0 encoding=UTF-8? connector xmlns=http://geronimo.apache.org/xml/ns/j2ee/connector-1.2; dep:environment xmlns:dep=http://geronimo.apache.org/xml/ns/deployment-1.2; dep:moduleId dep:groupIdconsole.jms/dep:groupId dep:artifactIdTest/dep:artifactId dep:version1.0/dep:version dep:typerar/dep:type /dep:moduleId dep:dependencies dep:dependency dep:groupIdorg.apache.geronimo.configs/dep:groupId dep:artifactIdactivemq-broker/dep:artifactId dep:typecar/dep:type /dep:dependency /dep:dependencies /dep:environment resourceadapter resourceadapter-instance resourceadapter-nameTest/resourceadapter-name nam:workmanager xmlns:nam=http://geronimo.apache.org/xml/ns/naming-1.2; nam:gbean-linkDefaultWorkManager/nam:gbean-link /nam:workmanager /resourceadapter-instance outbound-resourceadapter connection-definition connectionfactory-interfacejavax.jms.ConnectionFactory/connectionfactory-interface connectiondefinition-instance nameTestFactory/name implemented-interfacejavax.jms.QueueConnectionFactory/implemented-interface implemented-interfacejavax.jms.TopicConnectionFactory/implemented-interface connectionmanager xa-transaction transaction-caching/ /xa-transaction single-pool match-one/ /single-pool /connectionmanager /connectiondefinition-instance /connection-definition /outbound-resourceadapter /resourceadapter adminobject adminobject-interfacejavax.jms.Queue/adminobject-interface adminobject-classorg.apache.activemq.command.ActiveMQQueue/adminobject-class adminobject-instance message-destination-nameTestQueue/message-destination-name config-property-setting name=PhysicalNametestqueue/config-property-setting /adminobject-instance /adminobject adminobject adminobject-interfacejavax.jms.Topic/adminobject-interface adminobject-classorg.apache.activemq.command.ActiveMQTopic/adminobject-class /adminobject /connector I basically just left the defaults in it. However, the Servlet seems to work correctly as I see the following in the logs on hitting submit: 2009-08-26 10:17:13,713 DEBUG [ActiveMQSession] Sending message: ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:yoda-55927-1251270725979-3:25:1:1:4, originalDestination = null, originalTransactionId = null, producerId = ID:yoda-55927-1251270725979-3:25:1:1, destination = queue://testqueue, transactionId = null, expiration = 0, timestamp = 1251274633713, arrival = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = userid:ghjfgh} 2009-08-26 10:17:13,714 DEBUG [testqueue] No subscriptions registered, will not dispatch message at this time. So the message arrives at the queue but won't be dispatched because my EJB is not registered. The plan for the EJB now looks like: ?xml
Re: Message Driven Bean is not receiving messages
Hi, thanks, but unfortunately this leads to the following while deploying: Resource Adapter for MDB 'MDB'not found: ?j2eeType=JCAResourceAdapter,name=administeredObjectGroup# org.apache.geronimo.common.DeploymentException: Resource Adapter for MDB 'MDB'not found: ?j2eeType=JCAResourceAdapter,name=administeredObjectGroup# at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.setMdbContainerIds(EjbModuleBuilder.java:867) at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.addGBeans(EjbModuleBuilder.java:818) at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:647) at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255) at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:134) at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867) at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239) at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116) at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.geronimo.kernel.GBeanNotFoundException: No matches for referencePatterns: [?j2eeType=JCAResourceAdapter,name=administeredObjectGroup#] at org.apache.geronimo.kernel.config.Configuration.findGBeanData(Configuration.java:683) at org.apache.geronimo.kernel.config.Configuration.findGBean(Configuration.java:656) at org.apache.geronimo.kernel.config.Configuration.findGBean(Configuration.java:635) at org.apache.geronimo.deployment.DeploymentContext.findGBean(DeploymentContext.java:207) at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.setMdbContainerIds(EjbModuleBuilder.java:865) ... 14 more Stephan On Tue, Aug 25, 2009 at 17:05, Jack Caigreensi...@gmail.com wrote: dep:environment dep:moduleId dep:groupIddefault/dep:groupId dep:artifactIdTestEJB/dep:artifactId dep:version1.0/dep:version dep:typecar/dep:type /dep:moduleId dep:dependencies dep:dependency dep:groupIdorg.apache.geronimo.configs /dep:groupId dep:artifactIdactivemq-broker /dep:artifactId dep:typecar/dep:type /dep:dependency /dep:dependencies /dep:environment ejb:enterprise-beans ejb:message-driven ejb:ejb-nameMDB/ejb:ejb-name ejb:resource-adapter ejb:resource-linkadministeredObjectGroup/ejb:resource-link /ejb:resource-adapter /ejb:message-driven /ejb:enterprise-beans /ejb:openejb-jar
Re: Message Driven Bean is not receiving messages
Try the below deployment plan: ejb:openejb-jar [...] dep:environment dep:moduleId dep:groupIddefault/dep:groupId dep:artifactIdTestEJB/dep:artifactId dep:version1.0/dep:version dep:typecar/dep:type /dep:moduleId dep:dependencies dep:dependency dep:groupIdSlide 47 org.apache.geronimo.configs /dep:groupId dep:artifactIdactivemq-broker/dep:artifactId dep:typecar/dep:type /dep:dependency /dep:dependencies /dep:environment ejb:enterprise-beans ejb:message-driven ejb:ejb-nameMDB/ejb:ejb-name ejb:resource-adapter ejb:resource-linkadministeredObjectGroup/ejb:resource-link /ejb:resource-adapter /ejb:message-driven /ejb:enterprise-beans /ejb:openejb-jar -Jack On Mon, Aug 24, 2009 at 9:23 PM, Stephan Mehlhase s.mehlh...@googlemail.com wrote: Hi everyone, My setup is the following: I'm using Geronimo 2.1.4 on linux under Java 1.6 developing with Eclipse 3.5 EE (I'm using the nightly built 2.1.5 GEP plugin) I'm trying to set up a small message driven bean which receives messages that I've send from a JAX-WS Webservice. So I went into the adminstration console and created a JMS resource with one connection factory and one destination (called Test, TestFactory and TestQueue respectively). After doing so I wrote the webservice and it looks like this: @WebService public class TestServer { private static final Logger log = Logger.getLogger(TestServer.class); @Resource(name = TestFactory) private ConnectionFactory factory; @Resource(name = TestQueue) private Destination destination; @WebMethod public void test() { try { Connection con = factory.createConnection(); Session s = con.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = s.createProducer(destination); con.start(); p.send(s.createTextMessage(Test)); con.close(); log.info(Sent message); } catch (JMSException e) { log.warn(Exception, e); } } } (I'm not sure whether the connection.start() call is necessary but I added it just in case - it does not work without neither) Than I created the EJB like this: @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = destinationType, propertyValue = javax.jms.Queue), @ActivationConfigProperty(propertyName = destination, propertyValue = TestQueue) }, mappedName = TestQueue) public class MDB implements MessageListener { private static Logger log = Logger.getLogger(MDB.class); public void onMessage(Message message) { log.info(WE GOT A MESSAGE!); } } (I've played around with the items of @MessageDriven annotation (removing activation config, removing the mapped name) - nothing did change anything). The openejb-jar.xml is: ejb:openejb-jar [...] dep:environment dep:moduleId dep:groupIddefault/dep:groupId dep:artifactIdTestEJB/dep:artifactId dep:version1.0/dep:version dep:typecar/dep:type /dep:moduleId dep:dependencies dep:dependency dep:groupIdconsole.jms/dep:groupId dep:artifactIdTest/dep:artifactId dep:version1.0/dep:version dep:typerar/dep:type /dep:dependency /dep:dependencies /dep:environment ejb:enterprise-beans ejb:message-driven ejb:ejb-nameMDB/ejb:ejb-name ejb:resource-adapter ejb:resource-linkTest/ejb:resource-link /ejb:resource-adapter /ejb:message-driven /ejb:enterprise-beans /ejb:openejb-jar (I left out some namespace declarations) If I invoke the webservice I see the Sent message log entry but the EJB seems not to receive it (in fact it even does not get instantiated). So I checked the logs and have not found any error message and therefore enabled the logs for ActiveMQ to see whether the message is actually received. I found the following: Upon deployment: 2009-08-24 14:49:35,174 INFO [startup] Jndi(name=TestEJB/MDB) --
Message Driven Bean is not receiving messages
Hi everyone, My setup is the following: I'm using Geronimo 2.1.4 on linux under Java 1.6 developing with Eclipse 3.5 EE (I'm using the nightly built 2.1.5 GEP plugin) I'm trying to set up a small message driven bean which receives messages that I've send from a JAX-WS Webservice. So I went into the adminstration console and created a JMS resource with one connection factory and one destination (called Test, TestFactory and TestQueue respectively). After doing so I wrote the webservice and it looks like this: @WebService public class TestServer { private static final Logger log = Logger.getLogger(TestServer.class); @Resource(name = TestFactory) private ConnectionFactory factory; @Resource(name = TestQueue) private Destination destination; @WebMethod public void test() { try { Connection con = factory.createConnection(); Session s = con.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = s.createProducer(destination); con.start(); p.send(s.createTextMessage(Test)); con.close(); log.info(Sent message); } catch (JMSException e) { log.warn(Exception, e); } } } (I'm not sure whether the connection.start() call is necessary but I added it just in case - it does not work without neither) Than I created the EJB like this: @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = destinationType, propertyValue = javax.jms.Queue), @ActivationConfigProperty(propertyName = destination, propertyValue = TestQueue) }, mappedName = TestQueue) public class MDB implements MessageListener { private static Logger log = Logger.getLogger(MDB.class); public void onMessage(Message message) { log.info(WE GOT A MESSAGE!); } } (I've played around with the items of @MessageDriven annotation (removing activation config, removing the mapped name) - nothing did change anything). The openejb-jar.xml is: ejb:openejb-jar [...] dep:environment dep:moduleId dep:groupIddefault/dep:groupId dep:artifactIdTestEJB/dep:artifactId dep:version1.0/dep:version dep:typecar/dep:type /dep:moduleId dep:dependencies dep:dependency dep:groupIdconsole.jms/dep:groupId dep:artifactIdTest/dep:artifactId dep:version1.0/dep:version dep:typerar/dep:type /dep:dependency /dep:dependencies /dep:environment ejb:enterprise-beans ejb:message-driven ejb:ejb-nameMDB/ejb:ejb-name ejb:resource-adapter ejb:resource-linkTest/ejb:resource-link /ejb:resource-adapter /ejb:message-driven /ejb:enterprise-beans /ejb:openejb-jar (I left out some namespace declarations) If I invoke the webservice I see the Sent message log entry but the EJB seems not to receive it (in fact it even does not get instantiated). So I checked the logs and have not found any error message and therefore enabled the logs for ActiveMQ to see whether the message is actually received. I found the following: Upon deployment: 2009-08-24 14:49:35,174 INFO [startup] Jndi(name=TestEJB/MDB) -- Ejb(deployment-id=TestEJB/MDB) 2009-08-24 14:49:35,208 DEBUG [ActiveMQEndpointWorker] Starting 2009-08-24 14:49:35,219 DEBUG [ActiveMQEndpointWorker] Started 2009-08-24 14:49:35,219 INFO [startup] Created Ejb(deployment-id=TestEJB/MDB, ejb-name=MDB, container=console.jms/Test/1.0/rar.Test-javax.jms.MessageListener) 2009-08-24 14:49:35,219 INFO [startup] Deployed Application(path=/tmp/geronimo-deployer282244042823023765.tmpdir/TestEJB.zip) [...] 2009-08-24 14:49:35,328 DEBUG [AbstractRegion] Adding destination: queue://TestEJB/MDB 2009-08-24 14:49:35,356 DEBUG [JournalPersistenceAdapter] Waking for checkpoint to complete. 2009-08-24 14:49:35,387 DEBUG [JournalPersistenceAdapter] Checkpoint started. 2009-08-24 14:49:35,390 DEBUG [JournalPersistenceAdapter] Checkpoint done. 2009-08-24 14:49:35,414 DEBUG [AbstractRegion] Adding destination: topic://ActiveMQ.Advisory.Queue 2009-08-24 14:49:35,423 DEBUG [AbstractRegion] Adding destination: topic://ActiveMQ.Advisory.Consumer.Queue.TestEJB/MDB Upon Invocation of the Webservice: 2009-08-24 14:50:01,022 DEBUG [ActiveMQSession] Sending message: ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:yoda-40121-1251118162624-3:4:1:1:1,