1
votes
  1. I have an MDB for consuming a message of a Queue, on Jboss EAP 7.0.6 GA, IBM MQ 9
    package com.ryzorbent.demo.jms;

    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.ejb.TransactionAttribute;
    import javax.jms.JMSException;

    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;

    import org.jboss.ejb3.annotation.ResourceAdapter;

    @MessageDriven(name="EFRSTestMDB", activationConfig = {
            @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
            @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
            @ActivationConfigProperty(propertyName = "hostName", propertyValue = "localhost"),
            @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),
            @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),
            @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "EFRS_UAT"),
            @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/QUEUE"),
            @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")
        })

    @ResourceAdapter(value = "wmq.jmsra.rar")
    //@TransactionAttribute(value = "NoTransaction")

    public class EFRSTestMDB implements MessageListener {


        @Override
        public void onMessage(Message inMessage) {
            TextMessage message = (TextMessage)inMessage;
            try {
                System.out.println(String.format("Hello, %s", message.getText()));
            } catch (JMSException e) {
                e.printStackTrace();
            }
        }

    }
  1. I copied the wmq.jmsra.rar into the ../standalone/deployments
  2. Added the resource-adapters subsystem for the queues, channels, etc into the standalone-full.xml
  3. But i get the below error
java.lang.NoClassDefFoundError: Failed to link com/ryzorbent/demo/jms/EFRSTestMDB (Module "deployment.TestJbossMDB.jar:main" from Service Module Loader): javax/jms/MessageListener
2

2 Answers

1
votes

The wmq.jmsra.rar does not contain the JMS API classes like javax/jms/MessageListener from your error. In Limitations and Known Problems it says:

The deployment of the IBM WebSphere® MQ 7.5 resource adapter does not load the javax.jms.api module for your deployment. It also does not provide support for the new Jave EE 7 annotations like @JMSConnectionFactoryDefinitions, @JMSDestinationDefinition. It is necessary to have the messaging-activemq subsystem in the configuration to enable it. If you do not want the JBoss EAP messaging server to be started, add an empty messaging-activemq subsystem.

So you have to add the JMS api jars as well like described above.

0
votes

hWhen using IBM MQ messaging, always start with a "full" server configuration file such as standalone-full.xml. The "full" configuration files include JMS messaging.

As a side note, I see that your activation spec has:

        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/QUEUE"),

So you have useJNDI to false, but then you have destination that sure looks like a JNDI name. When you have useJNDI set to false, the destination name is the name of the queue on the IBM MQ side - normally in all caps, much like your queue manager and channel.