Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

JBoss 5.1.2 - Websphere MQ MDB Listener

SA-4427

Summary



prpc_j2ee14_jbossJBM.ear file is deployed with ejb-jar.xml, jboss.xml for enabling JMS MDB Listener. The following exception was seen on the Log and Listener was not started and Messages were not processed by the system:

11:19:34,626 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@5d3f5d3f(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@553f553f destination=jms/uho/UHOQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=WSMQJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=30000 useDLQ=false)
com.ibm.msg.client.jms.DetailedIllegalStateException: MQJCA1024: The session must not have a message listener.
An application attempted to set a message listener for a JMS session.
Modify the application so that it does not use a message listener.


Error Messages



11:19:34,626 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@5d3f5d3f(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@553f553f destination=jms/uho/UHOQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=WSMQJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=30000 useDLQ=false)
com.ibm.msg.client.jms.DetailedIllegalStateException: MQJCA1024: The session must not have a message listener.
An application attempted to set a message listener for a JMS session.
Modify the application so that it does not use a message listener.
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:154)
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:91)
at com.ibm.mq.connector.outbound.SessionWrapper.setMessageListener(SessionWrapper.java:346)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.setup(JmsServerSession.java:130)
at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.setupSessions(JmsServerSessionPool.java:197)
at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.start(JmsServerSessionPool.java:88)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupSessionPool(JmsActivation.java:656)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:359)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:761)


Steps to Reproduce



1. Create JMS MDB Listener, which processes the messages from MQ.
2. Deploy the EAR with required config changes on the development node.


Root Cause



This is a how-to question: how to configure MDB listener on JBoss EAP 5.1.2


Resolution




In this example, the name of the sample MDB is "TestMDBListener" and 
extract prbeans.jar shipped with PRPC to edit ejb-jar.xml and jboss.xml.

1. In ejb-jar.xml:

Add the following element inside <enterprise-beans>


        <!-- TestMDBListener -->
        <message-driven id="MessageDriven_TestMDBListener">
          <description>Message Driven Bean for JMS Listener TestMDBListener</description>
          <ejb-name>TestMDBListener</ejb-name>
          <ejb-class>com.pega.pegarules.internal.etier.mdb.PRJMSListenerBoot</ejb-class>
          <transaction-type>Container</transaction-type>
          <message-driven-destination id="MessageDrivenDestination_TestQueue">
            <destination-type>javax.jms.Queue</destination-type>
          </message-driven-destination>  
          <env-entry>
            <env-entry-name>PRListener</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>TestMDBListener</env-entry-value>
          </env-entry>
          <env-entry>
            <env-entry-name>UseCMT</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>true</env-entry-value>
          </env-entry>
          <ejb-local-ref id="EJBLocalRef_TestMDBListener_EngineBMTLocal">
            <description></description>
            <ejb-ref-name>ejb/EngineBMTLocal</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <local-home>com.pega.pegarules.internal.etier.interfaces.EngineLocalHome</local-home>
            <local>com.pega.pegarules.internal.etier.interfaces.EngineLocal</local>
            <ejb-link>EngineBMT</ejb-link>
          </ejb-local-ref>
          <ejb-local-ref id="EJBLocalRef_TestMDBListener_EngineCMTLocal">
            <description></description>
            <ejb-ref-name>ejb/EngineCMTLocal</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <local-home>com.pega.pegarules.internal.etier.interfaces.EngineLocalHome</local-home>
            <local>com.pega.pegarules.internal.etier.interfaces.EngineLocal</local>
            <ejb-link>EngineCMT</ejb-link>
          </ejb-local-ref>
          
        </message-driven>    

Add the following element inside <assembly-descriptor> element.        

           <container-transaction>
                    <method>
                        <ejb-name>TestMDBListener</ejb-name>
                        <method-name>onMessage</method-name>
                        <method-params>
                            <method-param>javax.jms.Message</method-param>
                        </method-params>
                    </method>
                    <trans-attribute>NotSupported</trans-attribute>
        </container-transaction>

2. In jboss.xml:    

Add the following element inside <enterprise-beans> element - note that the destination/channel/hostName/port/queueManager values need to be replaced according
to your own environment inside the <activation-config>. Also <destination-jndi-name> element also needs to be replaced with your own value.

        <!-- TestMDBListener -->
        <message-driven>
            <ejb-name>TestMDBListener</ejb-name>
            
            <activation-config>        
                 <activation-config-property>
                    <activation-config-property-name>destinationType</activation-config-property-name>
                    <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>destination</activation-config-property-name>
                    <activation-config-property-value>MDBQueue</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>channel</activation-config-property-name>
                    <activation-config-property-value>testmdb.channel</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>hostName</activation-config-property-name>
                    <activation-config-property-value>ZOSD01</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>port</activation-config-property-name>
                    <activation-config-property-value>1416</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>queueManager</activation-config-property-name>
                    <activation-config-property-value>CSQ7</activation-config-property-value>
                 </activation-config-property>
                 <activation-config-property>
                    <activation-config-property-name>transportType</activation-config-property-name>
                    <activation-config-property-value>CLIENT</activation-config-property-value>
                 </activation-config-property>
            </activation-config>
            <destination-jndi-name>testjbossmdbqueue</destination-jndi-name>
            
            <resource-adapter-name>wmq.jmsra.rar</resource-adapter-name>            
            <invoker-bindings>
                <invoker>
                <!-- comment out due to the JBOSS EAP 5.1 defect https://issues.jboss.org/i#browse/JBPAPP-5980
                    <invoker-proxy-binding-name>message-inflow-driven-bean</invoker-proxy-binding-name>
                -->
                
                    <invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name>
                            
                </invoker>
            </invoker-bindings>       
            <ejb-local-ref>
                <ejb-ref-name>ejb/EngineBMTLocal</ejb-ref-name>
                <local-jndi-name>ejb/PREngineBMTLocal</local-jndi-name>
            </ejb-local-ref>
            <ejb-local-ref>
                <ejb-ref-name>ejb/EngineCMTLocal</ejb-ref-name>
                <local-jndi-name>ejb/PREngineCMTLocal</local-jndi-name>
            </ejb-local-ref>
            <depends>jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
        </message-driven>
    </enterprise-beans>

3. Create a file called wmqueue-ds.xml (file name should always ends with -ds.xml) and place it under JBoss /deploy directory for your configuration. The content of the file should be similar to this - make sure that the values the corresponding elements/attributes are matching to those of specified in step 2 above.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<connection-factories>

   <mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.wmq:name=testjbossmdbqueue">

    <attribute name="JNDIName">testjbossmdbqueue</attribute>     

    <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>

    <attribute name="Type">javax.jms.Queue</attribute>

    <attribute name="Properties">

      baseQueueManagerName=CSQ7

      baseQueueName=MDBQueue

    </attribute>

  </mbean>
    <tx-connection-factory>
            <jndi-name>MQConnectionFactory</jndi-name>
            <rar-name>wmq.jmsra.rar</rar-name>
            <use-java-context>true</use-java-context>
            <connection-definition>javax.jms.ConnectionFactory</connection-definition>
            <min-pool-size>0</min-pool-size>
            <max-pool-size>10</max-pool-size>
            <blocking-timeout-millis>30000</blocking-timeout-millis>
            <idle-timeout-minutes>30</idle-timeout-minutes>
            <background-validation>false</background-validation>
            <background-validation-millis>0</background-validation-millis>
            <validate-on-match>true</validate-on-match>
            <use-fast-fail>false</use-fast-fail>
            <allocation-retry>0</allocation-retry>
            <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
            <config-property type="java.lang.String" name="channel">testmdb.channel</config-property>
            <config-property type="java.lang.String" name="hostName">ZOSD01</config-property>
            <config-property type="java.lang.String" name="port">1416</config-property>
            <config-property type="java.lang.String" name="queueManager">CSQ7</config-property>
            <config-property type="java.lang.String" name="transportType">CLIENT</config-property>
            <security-domain-and-application>JmsXARealm</security-domain-and-application>
            <metadata/>
            <xa-resource-timeout>0</xa-resource-timeout>
            <xa-transaction/>
    </tx-connection-factory>

</connection-factories>

4. Update prbeans.jar with the updated ejb-jar.xml and jboss.xml.
5. Update the prpc_j2ee14_jbossJBM.ear with the new prbeans.jar from step 4.
​6. Redeploy the ear from step 5.

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us