Tomee with Websphere MQ.
Can someone help me resolving below issue.
1. placed all jars files from rar under tomee/lib.
2. Added the below to conf/tomee.xml
<Container id="wmq" type="MESSAGE">
ResourceAdapter=wmqRA
MessageListenerInterface=javax.jms.MessageListener
ActivationSpecClass=com.ibm.mq.connector.inbound.ActivationSpecImpl
</Container>
<Resource id="wmqRA" type="com.ibm.mq.connector.ResourceAdapterImpl"
class-name="com.ibm.mq.connector.ResourceAdapterImpl">
connectionConcurrency=5
maxConnections=10
logWriterEnabled=true
reconnectionRetryCount=5
reconnectionRetryInterval=300000
traceEnabled=false
traceLevel=3
</Resource>
<Resource id="qcf" type="javax.jms.ConnectionFactory"
class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl">
TransactionSupport=none
ResourceAdapter=wmqRA
HostName=10.x.y.z
Port=1414
QueueManager=QM_TIERL
Channel=SYSTEM.ADMIN.SVRCONN
TransportType=Client
UserName=xyz
Password=xyz
</Resource>
<Resource id="wmq-javax.jms.QueueConnectionFactory"
type="javax.jms.QueueConnectionFactory"
class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl">
TransactionSupport=none
ResourceAdapter=wmqRA
</Resource>
<Resource id="wmq-javax.jms.TopicConnectionFactory"
type="javax.jms.TopicConnectionFactory"
class-name="com.ibm.mq.connector.outbound.ManagedTopicConnectionFactoryImpl">
TransactionSupport=none
ResourceAdapter=wmqRA
</Resource>
<Resource id="queue" type="javax.jms.Queue"
class-name="com.ibm.mq.connector.outbound.MQQueueProxy">
arbitraryProperties
baseQueueManagerName xyz
baseQueueName xzy
CCSID=1208
encoding=NATIVE
expiry=APP
failIfQuiesce=true
persistence=APP
priority=APP
readAheadClosePolicy=ALL
targetClient=JMS
</Resource>
<Resource id="wmq-javax.jms.Topic" type="javax.jms.Topic"
class-name="com.ibm.mq.connector.outbound.MQTopicProxy">
arbitraryProperties
baseTopicName
brokerCCDurSubQueue=SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE
brokerDurSubQueue=SYSTEM.JMS.D.SUBSCRIBER.QUEUE
brokerPubQueue
brokerPubQueueManager
brokerVersion=1
CCSID=1208
encoding=NATIVE
expiry=APP
failIfQuiesce=true
persistence=APP
priority=APP
readAheadClosePolicy=ALL
targetClient=JMS
</Resource>
Deployed War file:
using
<resource-ref>
<res-ref-name>myqcf</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<mapped-name>qcf</mapped-name>
</resource-ref>
<resource-env-ref>
<resource-env-ref-name>myqueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
<mapped-name>queue</mapped-name>
</resource-env-ref>
In Controller:
@Resource(name = "qcf")
private ConnectionFactory connectionFactory;
@Resource(name = "queue")
private Queue queue;
The rest was jms code.
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
TextMessage message = session.createTextMessage();
message.setText("test data");
connection.start();
producer.send(message);
session.close();
connection.close();
To suppress ActiveMQ from getting triggered add
openejb.offline=true to conf/system.properties
I am receiving below exception
INFO | JMSClient call start .....
INFO | Connector vm://localhost started
Dec 04, 2018 1:58:15 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet
[com.mbfs.slr.vds.services.VinServicePortBindingImpl] in context with path
[/SLRServices] threw exception [Servlet execution threw an exception] with
root cause
java.lang.NoSuchMethodError:
org.apache.activemq.ra.ManagedConnectionProxy.<init>(Lorg/apache/activemq/ra/ActiveMQManagedConnection;Ljavax/resource/spi/ConnectionRequestInfo;)V
at
org.apache.openejb.resource.activemq.jms2.TomEEManagedConnectionProxy.<init>(TomEEManagedConnectionProxy.java:40)
--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html