Stuart Clayton [
http://community.jboss.org/people/stuartclayton22] created the discussion
"Re: Using JNDI to connect to Websphere MQ, without hardcoded info"
To view the discussion, visit:
http://community.jboss.org/message/620767#620767
--------------------------------------------------------------
I have exactly the same problem with incoming MDBs (receive messages from MQ), with the
same versions of JBoss and MQ. I think maybe I have made a little progress by following
the
http://community.jboss.org/docs/DOC-12944
http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ hint for creating
an "aop domain". [Added while creating: problem solved.]
This "domain" contains all the context (host, port etc) that we currently have
either in the annotations, the ejb-jar.xml or the jboss.xml (there seems to be no
difference between the last two files, as far as where the activationSpecs are for queue
MDBs). This "domain" arranges for yet another ( ! ) set of "activationSpec
annotations" to be injected into the MDB class code, but indirectly instead of having
to put annotations explicity in the class source. Here is what the additional code in the
JBoss deploy/ejb3-interceptors-aop.xml file looks like (note that the
@org.jboss.annotation.ejb.DefaultActivationSpecs ({ ... stuff has to be on one line,
without CRLFs ):
The MDB declaration now looks like this:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName =
"messagingType", propertyValue = "javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra.rar")
@AspectDomain("IBMMQ Message Driven Bean")
public class ReadMQAgent implements MessageListener {
The ejb-jar.xml now looks like this:
<ejb-jar xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" xmlns:ejb="
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>ReadMQAgent</ejb-name>
<ejb-class>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent</ejb-class>
<activation-config>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>false</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>Q1</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
In the AOP "domain" declaration from the link given above, the annotation class
is specified as @org.jboss.annotation.ejb.DefaultActivationSpecs. Somewhere (can't
find it now) there was a user comment on this example, pointing out that the class should
be @org.jboss.ejb3.annotation.DefaultActivationSpecs.After I changed this accordingly, the
whole business finally worked. Before this last change, I was getting an MQ error about
"Q1" not being defined.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/620767#620767]
Start a new discussion in JNDI and Naming at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]