Author |
Message
|
nitizsood |
Posted: Tue Jan 10, 2006 2:56 am Post subject: Error | java.lang.NoSuchFieldError: msgToken |
|
|
Newbie
Joined: 10 Jan 2006 Posts: 2
|
I want to use JMS 1.1 APIs (not MQ JMS APIs) to connect to my Websphere MQ 6.0 queues. My application is sitting in WAS 6.0 and i am accessing queue connection factory and queue using JNDI.
The code snippet is as follows-
//Retreiving the factory from JNDI
java.util.Hashtable environment = new java.util.Hashtable();
Context ctx = new InitialDirContext( environment );
System.out.println("Initial Dir Context set");
//Connection factory
QueueConnectionFactory factory;
factory = (QueueConnectionFactory)ctx.lookup("qcf/MyQueueConnFac");
System.out.println("Connection factory created");
//create connection
QueueConnection connection;
connection = factory.createQueueConnection();
System.out.println("Connection created");
//start connection
connection.start();
System.out.println("Connection started");
//obtain a session
//QueueSession session;
Session session;
boolean transacted = false;
//session = connection.createQueueSession(transacted,
//Session.AUTO_ACKNOWLEDGE);
session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
System.out.println("Session created");
//Get Queue Objc from JNDI
Queue ioQueue;
ioQueue = (Queue)ctx.lookup( "jms/JMSExampleQueue" );
System.out.println("Queue Obj looked up");
//Create Message Producer
MessageProducer messageProducer = session.createProducer(ioQueue);
System.out.println("Message Producer created");
//Create Message
System.out.println( "Creating a TextMessage" );
TextMessage outMessage = session.createTextMessage();
System.out.println("Adding Text");
outMessage.setText("msgString");
//Send Message
messageProducer.send(outMessage);
}
catch(Exception e ){
System.out.println("ERROR" + e.getMessage());
return mapping.findForward("failure");
}
I am getting the following error-
SRVE0068E: Could not invoke the service() method on servlet action. Exception thrown : java.lang.NoSuchFieldError: msgToken
at com.ibm.mq.server.MQSESSION.init_conversion(Native Method)
at com.ibm.mq.server.MQSESSION.<clinit>(MQSESSION.java:254)
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:6
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:493)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:155)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:153)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:189)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:171)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:754)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:688)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:469)
at com.ibm.mq.MQSPIQueueManager.<init>(MQSPIQueueManager.java:52)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2238)
at com.ibm.mq.jms.MQConnection.createQMXA(MQConnection.java:1692)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:97)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:54)
at com.ibm.mq.jms.MQXAQueueConnection.<init>(MQXAQueueConnection.java:46)
at com.ibm.mq.jms.MQXAQueueConnectionFactory.createXAQueueConnection(MQXAQueueConnectionFactory.java:63)
at com.ibm.ejs.jms.JMSManagedQueueConnection.createConnection(JMSManagedQueueConnection.java:122)
at com.ibm.ejs.jms.JMSManagedConnection.<init>(JMSManagedConnection.java:241)
at com.ibm.ejs.jms.JMSManagedQueueConnection.<init>(JMSManagedQueueConnection.java:70)
at com.ibm.ejs.jms.WSJMSManagedQueueConnectionFactory.createManagedConnection(WSJMSManagedQueueConnectionFactory.java:95)
at com.ibm.ejs.jms.JMSManagedConnectionFactory.createManagedConnection(JMSManagedConnectionFactory.java:582)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1502)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:1294)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:2000)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:769)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:569)
at com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle.createQueueConnection(JMSQueueConnectionFactoryHandle.java:81)
at com.tcom.prokom.MQTest.TestBaseJMSAction.execute(TestBaseJMSAction.java:4
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at com.tkom.prokom.common.RequestProcessor.process(Unknown Source)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2841)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
I try to included the following jars in the WAS CLASS PATH but the error still persists-
C:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar
C:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar
C:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar
Can anyone please help? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 10, 2006 1:45 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Check out your samples.
You cannot use an empty hashtable for retrieving the JNDI.
You could however use something like this:
Code: |
Context ctx = new InitialContext(); |
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
nitizsood |
Posted: Wed Jan 11, 2006 12:41 am Post subject: That also does not work |
|
|
Newbie
Joined: 10 Jan 2006 Posts: 2
|
I have tried that too. But it does not work.
Finally I also tried to avoid JNDI to lookup for Queue Manager and Queue name by directly hardcoding it but that too does not work. It seems that there is some issue related to WAS. May be WAS6.0 JMS jars have some issue. Do i need to set WAS classpath to point to WebSphere MQ JMS jars. If yes then how to do that?
My new sample code -
try{
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
System.out.println("Factory transport set");
factory.setQueueManager("TestQM");
System.out.println("Q Manager");
QueueConnection connection = factory.createQueueConnection();
System.out.println("Connection created");
connection.start();
System.out.println("Connection started");
QueueSession session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
System.out.println("session created");
Queue ioQueue = session.createQueue("EXAMPLE.QUEUE");
System.out.println("Queue obj created");
QueueSender qSender = session.createSender(ioQueue);
System.out.println("Sender created");
String outString = "Hello World !!!!";
TextMessage outMessage = session.createTextMessage();
outMessage.setText(outString);
qSender.send(outMessage);
session.close();
connection.close();
} |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 11, 2006 2:36 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well somewhere either in your code or the app start the server HAS to know about the PROVIDER (MQ) implementation of JMS.
Now remember with WAS V60 you would use primarily the default JMS provider and create an MQ Link as a qmgr to qmgr connection from the JMS provider to MQ.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ryancox |
Posted: Wed Feb 08, 2006 3:38 pm Post subject: solution on the IBM support site |
|
|
Newbie
Joined: 08 Feb 2006 Posts: 1
|
you might have resolved this already, but just in case...
there is a solution documented on the IBM support site for this problem @
http://www-1.ibm.com/support/docview.wss?uid=swg21221195
the main issue is incompatibility between the WMQ 5.1 JMS jars that are included in WAS V6 and the WMQ 6.0 JMS jars that you need to access WMQ 6.0 _________________ - Ryan (ryancox@us.ibm.com) |
|
Back to top |
|
 |
BenR |
Posted: Thu Feb 09, 2006 1:13 am Post subject: |
|
|
Acolyte
Joined: 31 Jan 2006 Posts: 60 Location: Hursley, UK
|
Quote: |
the main issue is incompatibility between the WMQ 5.1 JMS jars that are included in WAS V6 and the WMQ 6.0 JMS jars that you need to access WMQ 6.0 |
Note that this is only true in bindings mode (JNI) - in client (TCP/IP) mode, the v5.3 client will talk quite happily to a WMQ v6 server.
Try running in client mode, rather than bindings (unless you specifically need to be in bindings mode). |
|
Back to top |
|
 |
|