Using deployment descriptors to define what Queue and MDB connects to
dshifrin Oct 10, 2017 6:11 PMThanks in advance for reading this.
I am attempting to remove annotations from my MDB and put them into a deployment descriptor. I am running Wildfly 9 and using hornettQ.
My annotations look like this
javax.ejb.MessageDriven(name = "TestEJB",
"TestEJB", activationConfig = {
@ActivationConfigProperty(propertyName="maxSession",
"1"),
@ActivationConfigProperty(propertyName="destination",
"DFPQUEUE"),
@ActivationConfigProperty(propertyName ="destinationType",
"javax.jms.Queue")
("hornetq-ra.rar")
class TestMDB implements MessageListener
I moved all this information to an ejb-jar.xml file like so
xml version="1.0" encoding="UTF-8"?>
ejb-jar version="3.1" 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_1.xsd">
<enterprise-beans>
<message-driven>
<ejb-name>TestMDB</ejb-name>
<ejb-class>com.wss.test.TestMDB</ejb-class>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>java:jboss/jms/DFPQUEUE</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>messageSelector</activation-config-property-name>
<activation-config-property-value>VSP='ATTMO'</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
ejb-jar>
When I deploy this MDB I get the following warning
WARN [org.hornetq.ra] (default-threads - 4) HQ152005: Failure in HornetQ activation org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@4353f93b connectionFactoryLookup=null destination=java:jboss/jms/DFPQUEUE destinationType=null selector=VSP='ATTMO' ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15): javax.naming.NameNotFoundException: jms/DFPQUEUE -- service jboss.naming.context.java.jboss.jms.DFPQUEUE
[Server:dfp_q_server_10] at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
[Server:dfp_q_server_10] at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
[Server:dfp_q_server_10] at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
[Server:dfp_q_server_10] at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:237)
[Server:dfp_q_server_10] at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
[Server:dfp_q_server_10] at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
[Server:dfp_q_server_10] at javax.naming.InitialContext.lookup(InitialContext.java:417)
My domain.xml looks like this
<jms-queue name="DFPQUEUE">
<entry name="java:jboss/exported/jms/DFPQUEUE"/>
<entry name="java:jboss/jms/DFPQUEUE"/>
<entry name="jms/DFPQUEUE"/>
<durable>true</durable>
</jms-queue>
I am wondering what I am missing. Any suggestions would be greatly appreciated.