<!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;">
Does JBoss Messaging violate the JEE 5 Specification?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/bech">Peer Bech Hansen</a> in <i>JBoss Messaging</i> - <a href="http://community.jboss.org/message/562832#562832">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p class="MsoNormal">Hi JBoss people</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p class="MsoNormal">For the project I’m currently working on, I’m trying to get JBoss Messaging to bridge messages from a JBoss queue to a IBM WebSphere MQ queue.</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p class="MsoNormal">I’m using IBM’s “WebSphere MQ resource adapter” and JCA administered objects to bind remote WMQ queues to my local JNDI.</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p class="MsoNormal">The guides I have followed, to configure the resource adaptor and to define my queues is found here:</p><p class="MsoNormal"><a class="jive-link-external-small" href="http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html">http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html</a></p><p class="MsoNormal"><a class="jive-link-wiki-small" href="http://community.jboss.org/docs/DOC-12535">http://community.jboss.org/wiki/UsingWebSphereMQSeriesWithJBossASPart4</a></p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p class="MsoNormal">To Bridge the messages im using the <span style="font-family: monospace; white-space: pre; "><strong style="font-weight: bold;">org.jboss.jms.server.bridge.BridgeService </strong></span>MBean as shown below:</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="jive-xml-tag"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="jive-xml-tag"><server></span>
     <span class="jive-xml-tag"><mbean code="org.jboss.jms.server.bridge.BridgeService"
          name="jboss.messaging:service=Bridge,name=WMQBridge"
          xmbean-dd="xmdesc/Bridge-xmbean.xml"></span>
         
      <span class="jive-xml-comment"><!-- The JMS provider loader that is used to lookup the source destination -->  
      <span class="jive-xml-tag"><depends optional-attribute-name="SourceProviderLoader"></span>jboss.messaging:service=JMSProviderLoader,name=JMSProvider<span class="jive-xml-tag"></depends></span>    
     
      <!-- The JMS provider loader that is used to lookup the target destination -->
      <span class="jive-xml-tag"><depends optional-attribute-name="TargetProviderLoader"></span>jboss.messaging:service=JMSProviderLoader,name=JMSWMQProvider<span class="jive-xml-tag"></depends></span>   
     
      <!-- The JNDI lookup for the source destination -->
      <span class="jive-xml-tag"><attribute name="SourceDestinationLookup"></span>queue/messagedistribution_contact_out<span class="jive-xml-tag"></attribute></span>
     
      <!-- The JNDI lookup for the target destination -->
      <span class="jive-xml-tag"><attribute name="TargetDestinationLookup"></span>queue/WMQTest_out<span class="jive-xml-tag"></attribute></span>  
     
      <!-- Optional: The Quality Of Service mode to use, one of:
           QOS_AT_MOST_ONCE = 0;
           QOS_DUPLICATES_OK = 1;
           QOS_ONCE_AND_ONLY_ONCE = 2; -->
      <span class="jive-xml-tag"><attribute name="QualityOfServiceMode"></span>1<span class="jive-xml-tag"></attribute></span>     
      <span class="jive-xml-tag"><attribute name="MaxBatchSize"></span>1<span class="jive-xml-tag"></attribute></span>    
      <span class="jive-xml-tag"><attribute name="MaxBatchTime"></span>-1<span class="jive-xml-tag"></attribute></span>     
      <span class="jive-xml-tag"><attribute name="FailureRetryInterval"></span>5000<span class="jive-xml-tag"></attribute></span>           
      <span class="jive-xml-tag"><attribute name="MaxRetries"></span>-1<span class="jive-xml-tag"></attribute></span>
     
    <span class="jive-xml-tag"></mbean></span>
     
<span class="jive-xml-tag"></server></span>der loader that is used to lookup the target destination --></span>
    <span class="jive-xml-tag"><depends optional-attribute-name="TargetProviderLoader"></span>jboss.messaging:service=JMSProviderLoader,name=JMSWMQProvider<span class="jive-xml-tag"></depends></span>   
     <span class="jive-xml-tag"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="jive-xml-tag"><server></span>
     <span class="jive-xml-tag"><mbean code="org.jboss.jms.server.bridge.BridgeService"
          name="jboss.messaging:service=Bridge,name=WMQBridge"
          xmbean-dd="xmdesc/Bridge-xmbean.xml"></span>
         
      <span class="jive-xml-tag"><depends optional-attribute-name="SourceProviderLoader"></span>jboss.messaging:service=JMSProviderLoader,name=JMSProvider<span class="jive-xml-tag"></depends></span>    
      <span class="jive-xml-tag"><depends optional-attribute-name="TargetProviderLoader"></span>jboss.messaging:service=JMSProviderLoader,name=JMSWMQProvider<span class="jive-xml-tag"></depends></span>   
      <span class="jive-xml-tag"><attribute name="SourceDestinationLookup"></span>queue/messagedistribution_contact_out<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="TargetDestinationLookup"></span>queue/WMQTest_out<span class="jive-xml-tag"></attribute></span>        
      <span class="jive-xml-tag"><attribute name="QualityOfServiceMode"></span>1<span class="jive-xml-tag"></attribute></span>     
      <span class="jive-xml-tag"><attribute name="MaxBatchSize"></span>1<span class="jive-xml-tag"></attribute></span>    
      <span class="jive-xml-tag"><attribute name="MaxBatchTime"></span>-1<span class="jive-xml-tag"></attribute></span>     
      <span class="jive-xml-tag"><attribute name="FailureRetryInterval"></span>5000<span class="jive-xml-tag"></attribute></span>           
      <span class="jive-xml-tag"><attribute name="MaxRetries"></span>-1<span class="jive-xml-tag"></attribute></span>     
    <span class="jive-xml-tag"></mbean></span>     
<span class="jive-xml-tag"></server></span></code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When the bridging is performed i get the following error:</p><pre class="jive-pre"><code class="jive-code">10:15:06,820 WARN  [Bridge] jboss.messaging:name=WMQBridge,service=Bridge Failed to set up connections
com.ibm.msg.client.jms.DetailedIllegalStateException: MQJCA1031: The method can only be called in the application client container. The application was not running in the application client container when this method was called.  Ensure that the application runs in the application client container, or modify the application to avoid this method call.
        at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:149)
        at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:86)
        at com.ibm.mq.connector.outbound.ConnectionWrapper.setExceptionListener(ConnectionWrapper.java:183)
        at org.jboss.jms.server.bridge.Bridge.setupJMSObjects(Bridge.java:1017)
        at org.jboss.jms.server.bridge.Bridge.setupJMSObjectsWithRetry(Bridge.java:1223)
        at org.jboss.jms.server.bridge.Bridge.access$1600(Bridge.java:68)
        at org.jboss.jms.server.bridge.Bridge$FailureHandler.run(Bridge.java:1569)
        at java.lang.Thread.run(Thread.java:619)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The “WebSphere MQ resource adapter” fails; telling me that an illegal method has been called.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>On line 1017 and 1025 of the class <strong>o</strong><strong><a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/messaging/tags/JBossMessaging_1_4_3_GA/src/main/org/jboss/jms/server/bridge/Bridge.java">rg.jboss.jms.server.bridge.Bridge</a></strong>, the method setExceptionListener() is called on the on the JMS ConnectionFactory.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span>On page 133 - 134 of the Java™ Platform, Enterprise Edition (Java EE) Specification, v5 (</span><a class="jive-link-external-small" href="http://jcp.org/aboutJava/communityprocess/final/jsr244/index.html" target="_blank">http://jcp.org/aboutJava/communityprocess/final/jsr244/index.html</a><span>) it is clearly stated that call to this method (and other methods), from web or EJB containers is prohibited.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The “WebSphere MQ resource adapter” has implemented this restriction and throws an Exception if the method is call on their ConnectionFactory implementation.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>So the questions is: </p><p>Isn’t JBoss Messaging violating the JEE5 specification, and how do I create a workaround for the problem?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have had the exact same error when using the JBoss ESB <a class="jive-link-thread-small" href="http://community.jboss.org/thread/156545">http://community.jboss.org/thread/156545</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Looking forward to hear your opinions.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Kind regards</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Peer Bech Hansen</p><p>Logica Denmark</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Environment used:</p><p>Microsoft Windows XP SP3</p><p>JBoss AS 5.1.0 GA</p><p>JBoss Messaging 1.4.3 GA</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/562832#562832">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>