Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-10440

Calling createConnection() method of Websphere MQ resource adapter implementation of QueueConnectionFactory and TopicConnectionFactorywith or without parameters always leads to exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • EAP_EWP 5.3.0.ER1
    • EAP_EWP 5.2.0 ER2, EAP_EWP 5.2.0 ER5, EAP_EWP 5.2.0 ER6
    • Messaging, TCK
    • None
    • TCK5 run

    • Workaround Exists
    • Hide

      use connection factories from the remote MQ broker (through external context):

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
            name="jboss.jms:service=JMSProviderLoader,name=WSMQJmsWNPMQMProvider">
          <attribute name="ProviderName">WSMQJmsWNPMQMProvider</attribute> 
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">IBMMQIntialContext/XACF</attribute>
          <attribute name="QueueFactoryRef">IBMMQIntialContext/XAQCF</attribute>
          <attribute name="TopicFactoryRef">IBMMQIntialContext/XATCF</attribute>
          <depends>jboss.jndi:service=ExternalContext,jndiName=IBMMQIntialContext</depends>
        </mbean> 
      

      where external context is defined like this:

      <mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=IBMMQIntialContext">
      <attribute name="JndiName">IBMMQIntialContext</attribute>
      <attribute name="InitialContext">javax.naming.InitialContext</attribute>
      <attribute name="RemoteAccess">true</attribute>
      <attribute name="Properties">
      java.naming.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory
      java.naming.factory.url.pkgs=com.ibm.mq.jms.naming
      java.naming.provider.url=dev120.mw.lab.eng.bos.redhat.com:1414/CH
      </attribute>
      </mbean>
      
      Show
      use connection factories from the remote MQ broker (through external context): <mbean code= "org.jboss.jms.jndi.JMSProviderLoader" name= "jboss.jms:service=JMSProviderLoader,name=WSMQJmsWNPMQMProvider" > <attribute name= "ProviderName" >WSMQJmsWNPMQMProvider</attribute> <attribute name= "ProviderAdapterClass" >org.jboss.jms.jndi.JNDIProviderAdapter</attribute> <attribute name= "FactoryRef" >IBMMQIntialContext/XACF</attribute> <attribute name= "QueueFactoryRef" >IBMMQIntialContext/XAQCF</attribute> <attribute name= "TopicFactoryRef" >IBMMQIntialContext/XATCF</attribute> <depends>jboss.jndi:service=ExternalContext,jndiName=IBMMQIntialContext</depends> </mbean> where external context is defined like this: <mbean code= "org.jboss.naming.ExternalContext" name= "jboss.jndi:service=ExternalContext,jndiName=IBMMQIntialContext" > <attribute name= "JndiName" >IBMMQIntialContext</attribute> <attribute name= "InitialContext" >javax.naming.InitialContext</attribute> <attribute name= "RemoteAccess" > true </attribute> <attribute name= "Properties" > java.naming.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory java.naming.factory.url.pkgs=com.ibm.mq.jms.naming java.naming.provider.url=dev120.mw.lab.eng.bos.redhat.com:1414/CH </attribute> </mbean>
    • Documented as Known Issue
    • NEW

    Description

      Calling createConnection() method of Websphere MQ resource adapter implementation of QueueConnectionFactory and TopicConnectionFactory with or without parameters always leads to exception

      88 tests in TCK affected.
      see
      https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP5/view/IBM-MQ/job/tck5-eap5x-jdk6-jms-ibmmq/19/testReport/unknownTestSuite.0/
      Impact for customers
      It's impossible to get connection in some cases.
      Reproducer info
      Failed test org.jboss.as.test.ibm.mq.tck.GetConnectionFromQueueConnectionTestCase in
      https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EAP5/view/IBM-MQ/job/_eap5-ibm-mq-tck-failures-reproducers/
      Link to reproducers execution:
      https://docspace.corp.redhat.com/docs/DOC-124332#rep
      Links for info how to setup IBM MQ locally
      https://docspace.corp.redhat.com/docs/DOC-114804#qi
      More detailed description
      Trying to execute this fragment leads to exception:
      MQJCA1026:Invalid operation for a domain specific object.

                  Context  context = new InitialContext();
                  QueueConnectionFactory cf = (QueueConnectionFactory) context.lookup("jms/QCF");
                  Queue queue = (Queue) context.lookup(QUEUE_1);
                  qCon = cf.createConnection();
      

      This is also true for TopicConnectionFactory implementation.

      Due to investigation of people from Spring https://jira.springsource.org/browse/SPR-9877?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab, it's caused by wrong implementation:

      We recompile the connector classes com.ibm.mq.connector.jar (same as mqconnector.jar)(sorry to IBM), find:
      QueueConnectionFactoryImpl.class

      public Connection createConnection()
          throws JMSException
        {     return createConnection(null, null);   }  
        public Connection createConnection(String username, String password)
          throws JMSException
        {
          if (ResourceAdapterImpl.getJCARuntimeHelper().getEnvironment() != 1) 
      {       return createQueueConnection(username, password);     }  
          throw ((JMSException)JCAExceptionBuilder.buildException(3, "MQJCA1026"));
        }
      

      But due to implementation, expression ResourceAdapterImpl.getJCARuntimeHelper().getEnvironment() always returns 1.
      As a workarond in TCK run we used Byteman script, that doesn't allow to throw this Exception.

      RULE enable QCF
       
      CLASS com.ibm.mq.connector.outbound.QueueConnectionFactoryImpl
      METHOD createConnection(java.lang.String, java.lang.String)
      AT ENTRY
      BIND qcf=$0
      IF TRUE
      DO traceln("!!!!!!!!!!call workaround QCF!!!");
      return qcf.createQueueConnection($1, $2)
       
      ENDRULE
       
      RULE enable TCF
       
      CLASS com.ibm.mq.connector.outbound.TopicConnectionFactoryImpl
      METHOD createConnection(java.lang.String, java.lang.String)
      AT ENTRY
      BIND tcf=$0
      IF TRUE
      DO traceln("!!!!!!!!!!call workaround TCF!!!");
      return tcf.createTopicConnection($1, $2)
       
      ENDRULE
      

      After this rule application, the method should look like this

      public Connection createConnection(String username, String password)
          throws JMSException
        {
           return createQueueConnection(username, password);    
        }
      

      Connection factories in *-ds.xml file for these tests were created this way:

      <connection-factories>
        <tx-connection-factory>
          <jndi-name>jms/QCF</jndi-name>
          <xa-transaction />
          <rar-name>wmq.jmsra.rar</rar-name>
          <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
          <config-property name="channel" type="java.lang.String">CH</config-property>
          <config-property name="hostName" type="java.lang.String">dev120.mw.lab.eng.bos.redhat.com</config-property>
          <config-property name="port" type="java.lang.String">1414</config-property>
          <config-property name="queueManager" type="java.lang.String">QM</config-property>
          <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
        </tx-connection-factory>
       
        <tx-connection-factory>
          <jndi-name>jms/TCF</jndi-name>
          <xa-transaction />
          <rar-name>wmq.jmsra.rar</rar-name>
          <connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
          <config-property name="channel" type="java.lang.String">CH</config-property>
          <config-property name="hostName" type="java.lang.String">dev120.mw.lab.eng.bos.redhat.com</config-property>
          <config-property name="port" type="java.lang.String">1414</config-property>
          <config-property name="queueManager" type="java.lang.String">QM</config-property>
          <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
        </tx-connection-factory>
      </connection-factories/>
      

      Attachments

        Issue Links

          Activity

            People

              rdickens_jira Russell Dickenson (Inactive)
              vrastsel_jira Vladimir Rastseluev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: