ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Error | java.lang.NoSuchFieldError: msgToken

Post new topic  Reply to topic
 Error | java.lang.NoSuchFieldError: msgToken « View previous topic :: View next topic » 
Author Message
nitizsood
PostPosted: Tue Jan 10, 2006 2:56 am    Post subject: Error | java.lang.NoSuchFieldError: msgToken Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
fjb_saper
PostPosted: Tue Jan 10, 2006 1:45 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
nitizsood
PostPosted: Wed Jan 11, 2006 12:41 am    Post subject: That also does not work Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
fjb_saper
PostPosted: Wed Jan 11, 2006 2:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
ryancox
PostPosted: Wed Feb 08, 2006 3:38 pm    Post subject: solution on the IBM support site Reply with quote

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
View user's profile Send private message Send e-mail
BenR
PostPosted: Thu Feb 09, 2006 1:13 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Error | java.lang.NoSuchFieldError: msgToken
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.