Hi,
What I am trying to do is from a servlet context listener in a webapp
send a message to an MDB deployed in the same ear. I have one setup
working but this requires configuration of the queue in glassfish.
Instead I am trying to use message linking now.
In the ejb-jar file I have the following ejb-jar.xml:
<ejb-jar xmlns="
http://java.sun.com/xml/ns/javaee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>TimerBean</ejb-name>
<ejb-class>org.wamblee.timer.TimerBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-link>InternalBootstrapQueue</message-destination-link>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<message-destination>
<message-destination-name>InternalBootstrapQueue</message-destination-name>
</message-destination>
</assembly-descriptor>
</ejb-jar>
In other words, there is a message destination InternalBootstrapQueue
which is linked to by a message-destination-link element.
In my web.xml, I am referring to this message destination as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="
http://java.sun.com/xml/ns/javaee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>org.wamblee.mythtv.Application</listener-class>
</listener>
<persistence-context-ref>
<persistence-context-ref-name>persistence/mythtv</persistence-context-ref-name>
</persistence-context-ref>
<message-destination-ref>
<message-destination-ref-name>MythtvTimer</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>InternalBootstrapQueue</message-destination-link>
</message-destination-ref>
</web-app>
In the servlet context listener I am using
@Resource(name = "MythtvTimer")
private Queue timerQueue;
to refer to the queue.
Nevertheless, at a deploy I am getting the following exception:
[#|2008-02-23T21:42:16.953+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.core.classloading|_ThreadID=14;_ThreadName=Timer-7;_RequestID=f04e24a9-f966-45f4-ab51-c014e6afb763;|LDR5004:
UnExpected error occured while creating ejb container
com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource
not created :
at
com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapter.java:1528)
at
com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.updateMDBRuntimeInfo(ActiveJmsResourceAdapter.java:1379)
at
com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:170)
at
com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:209)
at
com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:280)
What am I doing wrong? Should message linking work in this way?
Cheers
Erik