<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: Using JNDI to connect to Websphere MQ, without hardcoded info
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/stuartclayton22">Stuart Clayton</a> in <i>JNDI and Naming</i> - <a href="http://community.jboss.org/message/620789#620789">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p><span>I just had exactly the same problem with incoming MDBs (receive messages from MQ), with the same versions of JBoss and MQ. I solved it by following the </span><a class="jive-link-external-small" href="http://community.jboss.org/docs/DOC-12944" target="_blank">http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ</a><span> hint for creating an "aop domain", with an important correction.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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 ({ ...&#160; stuff has to be on one line, without CRLFs ):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code:xml}&lt;domain name="IBMMQ Message Driven Bean" extends="Intercepted Bean" inheritBindings="true"&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;bind pointcut="execution(public * *-&gt;*(..))"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/bind&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;!-- TODO: Authorization? --&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;bind pointcut="execution(public * *-&gt;*(..))"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ --&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;stack-ref name="EJBInterceptors"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/bind&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/annotation&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;annotation expr="!class(@org.jboss.annotation.ejb.DefaultActivationSpecs)"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @org.jboss.annotation.ejb.DefaultActivationSpecs ({@javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), @javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "127.0.0.1"), @javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM_APPLE"), @javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1415"), @javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/annotation&gt;&#160; </p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The MDB declaration now looks like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code:java}@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })</p><p>@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)</p><p>@ResourceAdapter(value = "wmq.jmsra.rar")</p><p>@AspectDomain("IBMMQ Message Driven Bean")</p><p>public class ReadMQAgent implements MessageListener {</p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The ejb-jar.xml now looks like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>{code:xml}&lt;ejb-jar xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><span>" xmlns:ejb="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd</a><span>" xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd</a><span>" version="3.0"&gt;</span></p><p>&#160; &lt;enterprise-beans&gt;</p><p>&#160;&#160;&#160; &lt;message-driven&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;ejb-name&gt;ReadMQAgent&lt;/ejb-name&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;ejb-class&gt;com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent&lt;/ejb-class&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160; &lt;activation-config&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property-name&gt;useJNDI&lt;/activation-config-property-name&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property-value&gt;false&lt;/activation-config-property-value&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/activation-config-property&gt;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property-name&gt;destination&lt;/activation-config-property-name&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;activation-config-property-value&gt;Q1&lt;/activation-config-property-value&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/activation-config-property&gt;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160; &lt;/activation-config&gt;</p><p>&#160;&#160;&#160; &lt;/message-driven&gt;</p><p>&#160; &lt;/enterprise-beans&gt;</p><p>&lt;/ejb-jar&gt;</p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/620789#620789">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JNDI and Naming at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>