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 » Reading a message from a queue error

Post new topic  Reply to topic Goto page 1, 2  Next
 Reading a message from a queue error « View previous topic :: View next topic » 
Author Message
TonyCooke
PostPosted: Wed Feb 08, 2006 6:16 pm    Post subject: Reading a message from a queue error Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Hi all.

I have the following exceptions and for the life of me I don't know what's going on.

I believe I have included all the relevent jars in the classpath but I still get the error.

Basically I get a message from WebSphereMQ 6.0.1 on a Windows box where the message originated from an iSeries box (in EBCIDIC format). I believe it converts it to unicode but the character mapping fails. I just don't know why.

Any help would be appreciated.

My classpath is:
Code:
.;\Program Files\Java\jre1.5.0_04\lib;
\Program Files\IBM\WebSphere MQ\Java\lib;
\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;
\sca\business_functions\lib\sca_bf.jar;
\sca\business_functions\lib\log.jar;
\sca\business_functions\lib\xalan.jar;
\sca\business_functions\lib\xerces.jar;
\sca\business_functions\lib\mail.jar;
\sca\business_functions\lib\smtp.jar;
\sca\business_functions\lib\activation.jar


All the best,
Tony

NOTE: This first exception is using the non-depricated readStringOfCharLength() method and the other exception is using the depricated method readString() (which calls readStringOfCharLength() anyway)

Code:
Exception in thread "Thread-0" java.lang.NoSuchMethodError: sun.io.ByteToCharSingleByte.createCharMap(Ljava/lang/String;Z)[C
 at sun.io.ByteToCharCp037.<clinit>(ByteToCharCp037.java:85)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at sun.io.Converters.getConverterClass(Unknown Source)
 at sun.io.Converters.newConverter(Unknown Source)
 at sun.io.ByteToCharConverter.getConverter(Unknown Source)
 at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
 at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
 at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)
 at java.io.InputStreamReader.<init>(Unknown Source)
 at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:2061)
 at com.ibm.mq.MQMessage.readStringOfCharLength(MQMessage.java:632)
 at com.elders.sca.commands.MQServerCommand.execute(MQServerCommand.java:52)
 at com.elders.sca.commands.CommandImpl.perform(CommandImpl.java:33)
 at com.elders.sca.control.EventHandler.handle(EventHandler.java:132)
 at com.elders.sca.control.Mediator.post(Mediator.java:111)
 at com.elders.sca.control.Mediator.start(Mediator.java:149)
 at com.elders.sca.business.BusinessFunction.run(BusinessFunction.java:51)
 at java.lang.Thread.run(Unknown Source)


Code:
Exception in thread "Thread-0" java.lang.NoSuchMethodError: sun.io.ByteToCharSingleByte.createCharMap(Ljava/lang/String;Z)[C
   at sun.io.ByteToCharCp037.<clinit>(ByteToCharCp037.java:85)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at sun.io.Converters.getConverterClass(Unknown Source)
   at sun.io.Converters.newConverter(Unknown Source)
   at sun.io.ByteToCharConverter.getConverter(Unknown Source)
   at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
   at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
   at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)
   at java.io.InputStreamReader.<init>(Unknown Source)
   at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:2061)
   at com.ibm.mq.MQMessage.readStringOfCharLength(MQMessage.java:632)
   at com.ibm.mq.MQMessage.readString(MQMessage.java:1053)
   at com.elders.sca.commands.MQServerCommand.execute(MQServerCommand.java:52)
   at com.elders.sca.commands.CommandImpl.perform(CommandImpl.java:33)
   at com.elders.sca.control.EventHandler.handle(EventHandler.java:132)
   at com.elders.sca.control.Mediator.post(Mediator.java:111)
   at com.elders.sca.control.Mediator.start(Mediator.java:149)
   at com.elders.sca.business.BusinessFunction.run(BusinessFunction.java:51)
   at java.lang.Thread.run(Unknown Source)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 08, 2006 7:21 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Looks like you may be missing jars from the classpath ?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
TonyCooke
PostPosted: Wed Feb 08, 2006 7:33 pm    Post subject: I agree Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Thanks fjb_saper for replying.

I agree with what you say, but what jars?

The charsets.jar file is in the classpath (\Program Files\Java\jre1.5.0_04\lib) which contains the conversion methods but it doesn't seem to work.

ie. charsets.jar contains the classes ByteToCharCp037 and ByteToCharSingleByte (including the method createCharMap())
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 08, 2006 7:42 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You need all the jars present in the <MQ Install>/java/lib !
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
EddieA
PostPosted: Wed Feb 08, 2006 7:56 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
You need all the jars present in the <MQ Install>/java/lib !

Not according to the V6 Information Center, you don't. It states that you only need the com.ibm.mq.jar.

But then again, the install program does add more, but not all, to the classpath in Windows. However, I wouldn't have thought a missing MQ jar would cause problems at that point.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
TonyCooke
PostPosted: Wed Feb 08, 2006 8:58 pm    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Hi all.

I've changed the classpath to the following:

Code:
set CLASSPATH=.;%CLASSPATH%;
D:\Program Files\Java\jre1.5.0_04\lib\charsets.jar;
D:\sca\business_functions\lib\sca_bf.jar;
D:\sca\business_functions\lib\log.jar;
D:\sca\business_functions\lib\xalan.jar;
D:\sca\business_functions\lib\xerces.jar;
D:\sca\business_functions\lib\mail.jar;
D:\sca\business_functions\lib\smtp.jar;
D:\sca\business_functions\lib\activation.jar


This should have got around the problem as it includes all the CLASSPATH information that the installation includes but unfortunately I still get the error.

Any other ideas where I may look. There are a lot of jars in the WebSphere MQ\Java\lib directory!
Back to top
View user's profile Send private message
TonyCooke
PostPosted: Wed Feb 08, 2006 10:01 pm    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Hi again.

I was looking through the Info Centre and there is a topic there called "Running the point-to-point IVT".

I decided to try it. The first one ran correctly "IVTRun -nojndi -m MQSCA01" but when I ran the second one "IVTRun -nojndi -client -m MQSCA01 -host localhost" I got the following exception:

Code:
D:\Program Files\IBM\WebSphere MQ\Java\bin>IVTRun -nojndi -client -m MQSCA01 -host localhost

5724-H72, 5655-L82, 5724-L26 (c) Copyright IBM Corp. 2002,2005. All Rights Reserved.
Websphere MQ classes for Java(tm) Message Service 6.0
Installation Verification Test


Creating a QueueConnectionFactory
Creating a Connection
Exception in thread "main" java.lang.NoSuchMethodError: sun.io.CharToByteSingleByte.expandByteMap([S[CII)[B
        at sun.io.CharToByteCp850.<clinit>(CharToByteCp850.java:338)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at sun.io.Converters.getConverterClass(Unknown Source)
        at sun.io.Converters.newConverter(Unknown Source)
        at sun.io.CharToByteConverter.getConverter(Unknown Source)
        at java.lang.StringCoding.encode(Unknown Source)
        at java.lang.String.getBytes(Unknown Source)
        at com.ibm.mq.MQInternalCommunications.isValidJavaCcsid(MQInternalCommunications.java:2008)
        at com.ibm.mq.MQv6InternalCommunications.parseInitialDataResponse(MQv6InternalCommunications.java:828)
        at com.ibm.mq.MQv6InternalCommunications.establishChannel(MQv6InternalCommunications.java:662)
        at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunications.java:206)
        at com.ibm.mq.MQv6InternalCommunications.<init>(MQv6InternalCommunications.java:102)
        at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)
        at com.ibm.mq.MQSESSIONClient.spiConnect(MQSESSIONClient.java:4473)
        at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:179)
        at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
        at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
        at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
        at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
        at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)
        at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)
        at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)
        at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
        at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:526)
        at com.ibm.mq.MQSPIQueueManager.<init>(MQSPIQueueManager.java:69)
        at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2007)
        at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1496)
        at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:150)
        at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:185)
        at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:112)
        at com.ibm.mq.jms.MQJMSIVT.main(MQJMSIVT.java:536)
D:\Program Files\IBM\WebSphere MQ\Java\bin>


Is there some part which wasn't installed correctly? I checked the classpath that is required and it seems OK.
Back to top
View user's profile Send private message
BenR
PostPosted: Wed Feb 08, 2006 11:34 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Jan 2006
Posts: 60
Location: Hursley, UK

What version of Java are you using? And which JVM (Sun or IBM)?

The first IVT is using a bindings (JNI) connection, the second is using client (TCP/IP). The failure happens when the client is checking the response it received from the server after making a connection request. Part of this check involves testing the CCSID sent by the server, and we do this by trying to use the Java class libraries to encode a test string with the String.getBytes(String charsetName). Usually this would fail with an UnsupportedEncodingException if the JVM can't support the charset that the queue manager is using.

In this case, the call to String.getBytes(String charsetName) is throwing a java.lang.NoSuchMethodError - that's not something I'd expect, and looks awfully like a defect somewhere in the Java class libraries you're using, rather than the MQ client.
Back to top
View user's profile Send private message Visit poster's website
TonyCooke
PostPosted: Wed Feb 08, 2006 11:39 pm    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Thanks BenR for your response.

I'm using Sun's JVM and it's version 1.5.0_04.
Back to top
View user's profile Send private message
BenR
PostPosted: Wed Feb 08, 2006 11:56 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Jan 2006
Posts: 60
Location: Hursley, UK

Are you running that on Windows? Sun's 1.5 JVM is only a supported JVM on Solaris x86-64 (if I remember correctly), so you should try the IBM 1.4.2 shipped with WMQ. Hopefully that should work.
Back to top
View user's profile Send private message Visit poster's website
TonyCooke
PostPosted: Thu Feb 09, 2006 2:13 am    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Yes I am running it on Windows.

I will try the IBM 1.4.2 JVM tomorrow.

The problem is I have a handful of 3rd party applications each using their own JVM in their own directory and I have our application using 1.5.
It looks like WebSphere MQ needs to load it's JVM globally.

Is there a way I can make it so that WebSphere MQ only uses it's own version of the JVM?
Back to top
View user's profile Send private message
mvic
PostPosted: Thu Feb 09, 2006 7:23 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

TonyCooke wrote:
Is there a way I can make it so that WebSphere MQ only uses it's own version of the JVM?

There is only one JVM that's relevant here - it's the one in which the whole app is running. You should be able to exert some control over this, by means of PATH settings and such like.

Just my $0.02 (actually in the UK it's GBP 0.02): the following:
Code:
Exception in thread "main" java.lang.NoSuchMethodError: sun.io.CharToByteSingleByte.expandByteMap([S[CII)[B
        at sun.io.CharToByteCp850.<clinit>(CharToByteCp850.java:338)

looks to my relatively-uneducated eyes like a problem occurring deep within the JRE. I am surprised if this is anything directly to do with MQ, or with MQ's interaction with the JRE.

EDIT: Corrected grammar in 2nd paragraph


Last edited by mvic on Thu Feb 09, 2006 2:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
TonyCooke
PostPosted: Thu Feb 09, 2006 12:43 pm    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

I agree. I've been over the classpath problem for the last 2 days and I still get this error.

Is this something that should be reported to Sun do you think?
Back to top
View user's profile Send private message
mvic
PostPosted: Thu Feb 09, 2006 1:12 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

TonyCooke wrote:
Is this something that should be reported to Sun do you think?

They would probably like to be informed, and I imagine you would probably like to have a resolution to the problem, so yes it seems a good idea. It would also be interesting to see how you get on using the JRE supplied with MQ.
Back to top
View user's profile Send private message
TonyCooke
PostPosted: Thu Feb 09, 2006 1:42 pm    Post subject: Reply with quote

Novice

Joined: 08 Feb 2006
Posts: 15

Is this reproducable on someone else's machine?

I will try it on my machine at work but I'd be interested to know if someone could do it on their machine and reproduce the error.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » Reading a message from a queue error
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.