<!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;">
    Not a JBossDestination when writing to a websphere MQ using Websphere resource adapter
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/hodneeri">hodneeri</a> in <i>JBoss Messaging</i> - <a href="http://community.jboss.org/message/562883#562883">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have a problem when connecting between JBoss 4.3.0 and a Websphere MQ.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have followed the procedure described here:</p><p><a class="jive-link-external-small" href="http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html?ca=drs">http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html?ca=drs</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Earlier I have made a connection to a Websphere MQ using an MDB like described in the document, and it works fine. It picks up incomming messages as expected.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Now I want to write a message from my application to a Websphere MQ, but then I get trouble. Here is my setup:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have deployed wmq.jmsra.rar in the deploy-directory on my jboss, and I have put <em>com.ibm.mqetclient.jar</em> in the lib-directory. These seem to work fine, and are also used by my MDB which is already working.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In<em> wmq.jmsra-ds.xml</em>, my mbean look like this (I have swapped the names of queues and hosts with examples):</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-comment">&lt;!-- mbeans defining JCA administered objects --&gt;
&#160; <span class="jive-xml-tag">&lt;mbean code="org.jboss.resource.deployment.AdminObject"
&#160;&#160;&#160;&#160;&#160; name="jca.wmq:name=ivtqueue"&gt;</span>

&#160;&#160;&#160; &lt;!-- Bind this AdminObject&#160; with the JNDI name IVTQueue --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="JNDIName"&gt;</span>
&#160;&#160;&#160;&#160;&#160; IVTQueue
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/attribute&gt;</span>

&#160;&#160;&#160; &lt;!-- this MBean depends on the WebSphere MQ resource adapter --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;depends optional-attribute-name="RARName"&gt;</span>
&#160;&#160;&#160;&#160;&#160; jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/depends&gt;</span>

&#160;&#160;&#160; &lt;!-- this admin object is a javax.jms.Queue --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="Type"&gt;</span>javax.jms.Queue<span class="jive-xml-tag">&lt;/attribute&gt;</span>

&#160;&#160;&#160; &lt;!--
&#160;&#160;&#160;&#160;&#160;&#160; Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent 
&#160;&#160;&#160;&#160;&#160;&#160; to this queue will have their expiry time overridden so that messages never expire
&#160;&#160;&#160; --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;attribute name="Properties"&gt;</span>
&#160;&#160;&#160;&#160;&#160; baseQueueManagerName=ExampleQueueManager
&#160;&#160;&#160;&#160;&#160; baseQueueName=ExampleQueueName
&#160;&#160;&#160;&#160;&#160; &lt;!--expiry=EXP_UNLIMITED--&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/attribute&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/mbean&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My tx connectionfactory:</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;tx-connection-factory&gt;</span>

&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- Bind this ConnectionFactory with the JNDI name IVTCF --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jndi-name&gt;</span>IVTCF<span class="jive-xml-tag">&lt;/jndi-name&gt;</span>

&#160;&#160;&#160; &lt;!-- Indicate that the connection factory supports XA transactions --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-transaction /&gt;</span>

&#160;&#160;&#160; &lt;!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;rar-name&gt;</span>wmq.jmsra.rar<span class="jive-xml-tag">&lt;/rar-name&gt;</span>

&#160;&#160;&#160; &lt;!-- connection-definition is the ConnectionFactory interface 
&#160;&#160;&#160;&#160;&#160; defined in the ra.xml --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;connection-definition&gt;</span>
&#160;&#160;&#160;&#160;&#160; javax.jms.ConnectionFactory
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/connection-definition&gt;</span>

&#160;&#160;&#160; &lt;!--
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Configuration for the ConnectionFactory. This defines the channel, hostname, port,
&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueManager, and transportType properties for a client (TCP/IP) connection to WMQ
&#160;&#160;&#160; --&gt;
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config-property name="channel" type="java.lang.String"&gt;</span>
&#160;&#160;&#160;&#160;&#160; Channel
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config-property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config-property name="hostName" type="java.lang.String"&gt;</span>
&#160;&#160;&#160;&#160;&#160; hostName
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config-property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config-property name="port" type="java.lang.String"&gt;</span>
&#160;&#160;&#160;&#160;&#160; 40203
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config-property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config-property name="queueManager" type="java.lang.String"&gt;</span>
&#160;&#160;&#160;&#160;&#160; QUEUEMANAGER
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config-property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config-property name="transportType" type="java.lang.String"&gt;</span>
&#160;&#160;&#160;&#160;&#160; CLIENT
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/config-property&gt;</span>

&#160;&#160;&#160; &lt;!-- define security domain --&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;security-domain-and-application&gt;</span>JmsXARealm<span class="jive-xml-tag">&lt;/security-domain-and-application&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/tx-connection-factory&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Now I deploy the testapplication <em>wmq.jmsra.ivt.ear</em>, and the testapplication runs fine, saying it creates a connection to the destination and sends a test message.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I now try to run my own code, I have refactored it to one short method here to illustrate how I do it:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>private</b></font> <font color="navy"><b>void</b></font> connectAndSendMessage(String message) <font color="navy"><b>throws</b></font> LoginException, JMSException, NamingException, CreateException, ConfigurationException, IOException<font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; InitialContext ctx = <font color="navy"><b>new</b></font> InitialContext();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Queue queue = (Queue) ctx.lookup(<font color="red">"IVTQueue"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(<font color="red">"IVTCF"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection queueConnection = qcf.createQueueConnection();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueConnection.start();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSender send = <font color="navy"><b>null</b></font>;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font><font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; send = queueSession.createSender(queue);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextMessage tm = queueSession.createTextMessage(<font color="navy"><b>new</b></font> Base64().encode(message));
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; send.send(tm);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font><font color="navy"><b>finally</b></font><font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font>(send!=<font color="navy"><b>null</b></font>)<font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; send.close();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
<font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When I try to run it, it manages to get a QueueSession, but when it tries to create a QueueSender, I get the following exception:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">javax.jms.InvalidDestinationException: Not a JBossDestination:queue://ExampleQueueManager/ExampleQueueName
&#160;&#160;&#160; at org.jboss.jms.client.JBossSession.createProducer(JBossSession.java:206)
&#160;&#160;&#160; at org.jboss.jms.client.JBossSession.createSender(JBossSession.java:406)
&#160;&#160;&#160; at com.ec.company.util.outbound.OutboundMQBuisnessAction.sendMessageJMS(OutboundMQBuisnessAction.java:81)
&#160;&#160;&#160; at com.ec.company.util.outbound.OutboundMQBuisnessAction.transferSPSales(OutboundMQBuisnessAction.java:131)
&#160;&#160;&#160; at com.ec.company.util.outbound.OutboundMQBuisnessAction.execute(OutboundMQBuisnessAction.java:57)
&#160;&#160;&#160; at com.ec.eccore.controller.ejb.BusinessControllerBean.executeAction(BusinessControllerBean.java:422)
&#160;&#160;&#160; at com.ec.eccore.controller.ejb.BusinessControllerBean.handleEvent(BusinessControllerBean.java:345)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:585)
&#160;&#160;&#160; at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
&#160;&#160;&#160; at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
&#160;&#160;&#160; at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
&#160;&#160;&#160; at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
&#160;&#160;&#160; at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
&#160;&#160;&#160; at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
&#160;&#160;&#160; at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:404)
&#160;&#160;&#160; at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
&#160;&#160;&#160; at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
&#160;&#160;&#160; at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
&#160;&#160;&#160; at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
&#160;&#160;&#160; at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
&#160;&#160;&#160; at org.jboss.ejb.Container.invoke(Container.java:960)
&#160;&#160;&#160; at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:585)
&#160;&#160;&#160; at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
&#160;&#160;&#160; at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
&#160;&#160;&#160; at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
&#160;&#160;&#160; at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
&#160;&#160;&#160; at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
&#160;&#160;&#160; at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
&#160;&#160;&#160; at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
&#160;&#160;&#160; at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
&#160;&#160;&#160; at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
&#160;&#160;&#160; at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
&#160;&#160;&#160; at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
&#160;&#160;&#160; at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
&#160;&#160;&#160; at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
&#160;&#160;&#160; at $Proxy174.handleEvent(Unknown Source)
&#160;&#160;&#160; at com.ec.frmw.scheduler.job.BusinessControllerInvokerJob.executeBusinessController(BusinessControllerInvokerJob.java:111)
&#160;&#160;&#160; at com.ec.frmw.scheduler.job.BusinessControllerInvokerJob.execute(BusinessControllerInvokerJob.java:81)
&#160;&#160;&#160; at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
&#160;&#160;&#160; at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Have anybody seen this before, and can point me in the correct direction?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Regards,</p><p>Erik</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/562883#562883">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


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

</div>

</body>
</html>