This discussion is archived
0 Replies Latest reply: Feb 19, 2008 11:45 PM by 807581 RSS

Integrating Sun App Server with WebSphere MQ

807581 Newbie
Currently Being Moderated
Hi,

I am using Sun App server V8.1 . I also have a websphere MQ v5.3 installed in my system. I want to integrate this MQ with the App server.
I created a queueManager and a Queue in MQ and using the JMSAdmin console of the Mq, i created jndi lookup resources using INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory


In the application server side, i created a Resource adapter using the command:
create-resource-adapter-config --property SupportsXA=true:ProviderIntegrationMode=jndi:RMPolicy=OnePerPhysicalConnection:JndiProperties=java.naming.factory.url.pkgs\\=com.ibm.mq.jms.naming,java.naming.factory.initial\\=com.sun.jndi.fscontext.RefFSContextFactory,java.naming.provider.url\\=file\\:D\\:\\MQ:LogLevel=finest mqra

Then i deployed this resource adaptor using the command :

deploy name mqra target server "D:\Sun\AppServer\lib\addons\resourceadapters\genericjmsra\genericra.rar"

Using this resource adapter i created a connection pool, connector resource and an admin object using the commands

create-connector-connection-pool raname mqra connectiondefinition javax.jms.QueueConnectionFactory transactionsupport  XATransaction property ConnectionFactoryJndiName=MQQCF mymqpool

create-connector-resource --poolname mymqpool jms/MyMqQCF

create-admin-object raname mqra restype javax.jms.Queue --property DestinationJndiName=RTQueue jms/MyMqQueue

After that, i wrote a java code to lookup these resources and put a message into the queue.

This is the snippet of my java code


InitialContext ic = new InitialContext();
QueueConnectionFactory cnxFact = (QueueConnectionFactory)ic.lookup("jms/MyMqQCF");
Queue qu = (Queue)ic.lookup("jms/MyMqQueue");
try {               

QueueConnection qConn = cnxFact.createQueueConnection();
QueueSession qSess = qConn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
QueueSender qSend = qSess.createSender(qu);
TextMessage msg = qSess.createTextMessage();
msg.setText("1");
qSend.send(msg);
qConn.close();


I am getting an exception in the line, QueueConnection qConn = cnxFact.createQueueConnection();

here is the stack trace

java.lang.ClassCastException: com.ibm.mq.jms.MQQueueConnectionFactory
at com.sun.genericra.outbound.ManagedQueueConnectionFactory.createXAConnection(ManagedQueueConnectionFactory.java:45)
at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createPhysicalConnection(AbstractManagedConnectionFactory.java:127)
at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:111)
at com.sun.enterprise.resource.ConnectorAllocator.createResource(ConnectorAllocator.java:90)
at com.sun.enterprise.resource.IASNonSharedResourcePool.getUnenlistedResource(IASNonSharedResourcePool.java:437)
at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:355)
at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:250)
at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:213)
at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:174)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:286)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:145)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:121)
at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:69)
at com.sun.genericra.outbound.ConnectionFactory.createQueueConnection(ConnectionFactory.java:101)

Can anybody help???