Try the below deployment plan:
<ejb:openejb-jar
[...]
>
<dep:environment>
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>TestEJB</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>Slide 47
org.apache.geronimo.configs </dep:groupId>
<dep:artifactId>activemq-broker</dep:artifactId>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<ejb:enterprise-beans>
<ejb:message-driven>
<ejb:ejb-name>MDB</ejb:ejb-name>
<ejb:resource-adapter>
<ejb:resource-link>administeredObjectGroup</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 <[email protected]
> 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:groupId>default</dep:groupId>
> <dep:artifactId>TestEJB</dep:artifactId>
> <dep:version>1.0</dep:version>
> <dep:type>car</dep:type>
> </dep:moduleId>
> <dep:dependencies>
> <dep:dependency>
> <dep:groupId>console.jms</dep:groupId>
> <dep:artifactId>Test</dep:artifactId>
> <dep:version>1.0</dep:version>
> <dep:type>rar</dep:type>
> </dep:dependency>
> </dep:dependencies>
> </dep:environment>
> <ejb:enterprise-beans>
> <ejb:message-driven>
> <ejb:ejb-name>MDB</ejb:ejb-name>
> <ejb:resource-adapter>
> <ejb:resource-link>Test</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, originalDestination
> = null, originalTransactionId = null, producerId =
> ID:yoda-40121-1251118162624-3:4:1:1, destination = topic://testqueue,
> transactionId = null, expiration = 0, timestamp = 1251118201019,
> 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 = Test}
> 2009-08-24 14:50:01,056 DEBUG [AbstractRegion] Adding destination:
> topic://ActiveMQ.Advisory.Producer.Topic.testqueue
> 2009-08-24 14:50:01,057 DEBUG [AbstractRegion] Adding destination:
> topic://testqueue
> 2009-08-24 14:50:01,095 INFO [TestServer] Sent message
> 2009-08-24 14:50:01,132 DEBUG [AbstractRegion] Removing consumer:
> ID:yoda-40121-1251118162624-3:4:-1:1
>
>
> I do not know what these "Adding Destination" messages mean, but that
> they are not in sync at deployment and afterwards makes me wonder
> whether this could be the reason why the EJB is not receiving messages
> and what could be the reason that they are not in sync.
>
> Any help is appreciated.
>
> Best,
> Stephan
>