<!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/620823#620823">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I just had exactly the same problem with incoming MDBs (receiving messages from MQ), with the same versions of JBoss and MQ. I solved it after literally days of investigation, by following the <a class="jive-link-wiki-small" href="http://community.jboss.org/docs/DOC-12944" target="_blank">http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ</a> hint for creating an "aop domain", with an important correction.</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.ejb3.annotation.DefaultActivationSpecs ({ ...&#160; stuff has to be on one line, without CRLFs ):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;domain name="IBMMQ Message Driven Bean" extends="Intercepted Bean" inheritBindings="true"&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;bind pointcut="execution(public * *-&gt;</span>*(..))<span class="jive-xml-quote">&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/bind&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- TODO: Authorization? --&gt;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;bind pointcut="execution(public * *-&gt;</span>*(..))"&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ --&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;stack-ref name="EJBInterceptors"/&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/bind&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)"&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @org.jboss.ejb3.annotation.Pool (value=</span>StrictMaxPool<span class="jive-xml-quote">, maxSize=15, timeout=10000)&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/annotation&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;annotation expr="!class(@org.jboss.ejb3.annotation.DefaultActivationSpecs)"&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @org.jboss.ejb3.annotation.DefaultActivationSpecs ({@javax.ejb.ActivationConfigProperty(propertyName = </span>channel<span class="jive-xml-quote">, propertyValue = </span>SYSTEM.DEF.SVRCONN<span class="jive-xml-quote">), @javax.ejb.ActivationConfigProperty(propertyName = </span>hostName<span class="jive-xml-quote">, propertyValue = </span>127.0.0.1<span class="jive-xml-quote">), @javax.ejb.ActivationConfigProperty(propertyName = </span>queueManager<span class="jive-xml-quote">, propertyValue = </span>QM_APPLE<span class="jive-xml-quote">), @javax.ejb.ActivationConfigProperty(propertyName = </span>port<span class="jive-xml-quote">, propertyValue = </span>1415<span class="jive-xml-quote">), @javax.ejb.ActivationConfigProperty(propertyName = </span>transportType<span class="jive-xml-quote">, propertyValue = </span>CLIENT")})&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/annotation&gt;</span>&#160; </code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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><pre class="jive-pre"><code class="jive-code jive-java">@MessageDriven(activationConfig = <span style="color: navy;">{</span> @ActivationConfigProperty(propertyName = <span style="color: red;">"messagingType"</span>, propertyValue = <span style="color: red;">"javax.jms.MessageListener"</span>),&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <span style="color: red;">"destinationType"</span>, propertyValue = <span style="color: red;">"javax.jms.Queue"</span>) <span style="color: navy;">}</span>) @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @ResourceAdapter(value = <span style="color: red;">"wmq.jmsra.rar"</span>) @AspectDomain(<span style="color: red;">"IBMMQ Message Driven Bean"</span>) <span style="color: navy;"><strong>public</strong></span> <span style="color: navy;"><strong>class</strong></span> ReadMQAgent <span style="color: navy;"><strong>implements</strong></span> MessageListener <span style="color: navy;">{</span> </code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;ejb-jar xmlns:xsi="<a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns="<a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a>" xmlns:ejb="<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>" xsi:schemaLocation="<a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a> <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>" version="3.0"&gt;</span>&#160;&#160; <span class="jive-xml-tag">&lt;enterprise-beans&gt;</span>&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;message-driven&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;ejb-name&gt;</span>ReadMQAgent<span class="jive-xml-tag">&lt;/ejb-name&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;ejb-class&gt;</span>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent<span class="jive-xml-tag">&lt;/ejb-class&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property-name&gt;</span>useJNDI<span class="jive-xml-tag">&lt;/activation-config-property-name&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property-value&gt;</span>false<span class="jive-xml-tag">&lt;/activation-config-property-value&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/activation-config-property&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property-name&gt;</span>destination<span class="jive-xml-tag">&lt;/activation-config-property-name&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;activation-config-property-value&gt;</span>Q1<span class="jive-xml-tag">&lt;/activation-config-property-value&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/activation-config-property&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/activation-config&gt;</span>&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/message-driven&gt;</span>&#160;&#160; <span class="jive-xml-tag">&lt;/enterprise-beans&gt;</span> <span class="jive-xml-tag">&lt;/ejb-jar&gt;</span> </code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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 was 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 as expected. Before this last change, I was getting an MQ error about "Q1" not being defined.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Of course there is never an upside without a downside. Now the eclipse console favors me with a extra splodge of JBoss startup warnings that don't amount to a hill of beans, apparently, because everything works fine: 165 consecutive repetitions of the line</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code"> 09:25:49,006 WARN&#160; [AnnotationCreator] No ClassLoader provided, using TC</code></pre></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/620823#620823">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>