Author |
Message
|
zvirbulis |
Posted: Thu Jul 16, 2009 9:55 pm Post subject: MQ 6 to 7 - establishing of queue manager causes 2298, 2195 |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
Unfortunately I will not be able to provide much info here, but perhaps can give some ideas about what might have changed between Mq 6 and 7 that would cause this strange behavior.
Our application worked fine with MQ 6. Now, however, it compiles fine against MQ 7, but when it runs, the code to establish the connection to the queue manager throws an exception.
Queue manager defined like:
private MQQueueManager queue_manager;
then later
queue_manager = new MQQueueManager("QMGR");
causes
com.ibm.mq.MQException:
MQJE001: Completion Code '2', Reason '2298'.
at com.ibm.mq.MQSESSION.<init>(MQSESSION.java:2109)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:2147)
...
and also
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code received. [1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.local.LocalServer
.<init>(com.ibm.mq.jmqi.JmqiEnvironment,int)],3=Class.getConstructor0]
I can write a very short MQ connect script that does something similar, and that connects to the queue manager without issue.
What it seems to be related to is the location of the queue manager connect attempt - it is very deep in our application code. Should I put the attempt to connect to the queue manager earlier in our application code, the connect works fine - so, for whatever reason, if the queue manager connect is buried deep in the code, it gives the 2298/2195 combo.
Again, the code worked with MQ 6, so perhaps MQ 7 got stricter about queue manager connections?
I realize this isn't much to work with, but anything I could check, or anything to be aware of when upgrading 6 to 7 could potentially be helpful. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jul 16, 2009 11:00 pm Post subject: Re: MQ 6 to 7 - establishing of queue manager causes 2298, 2 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
zvirbulis wrote: |
I realize this isn't much to work with, but anything I could check, or anything to be aware of when upgrading 6 to 7 could potentially be helpful. |
Well given what 2298 means I'd double check the Java manual for v7. Not my thing personally, but you might find a clue.
If there's a 2195 there should be an FDC file associated with it. Possibly more clues there. If all else fails raise a PMR - the queue manager should never throw a 2195 even if your code is doing something unsupported. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
anilit99 |
Posted: Fri Jul 17, 2009 1:46 am Post subject: |
|
|
 Voyager
Joined: 28 May 2009 Posts: 75 Location: London, UK
|
Quote: |
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code received. [1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.local.LocalServer
.<init>(com.ibm.mq.jmqi.JmqiEnvironment,int)],3=Class.getConstructor0] |
I may not be very helpful here, but the NoSuchMethodException is making me to think, that we have the problem of some confused jars.
com.ibm.mq.jar is the one which contains this constructor. I am using V7, btw. _________________ "I almost care !" |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 1:53 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
Currently in my classpath, when using MQ 7, I have the following jars
com.ibm.mq.jar
connector.jar
com.ibm.mq.jmqi.jar
when the application was working fine with MQ 6, I had only the first two jars in the classpath (the jmqi.jar only became necessary because MQException.class was moved to that jar) |
|
Back to top |
|
 |
anilit99 |
Posted: Fri Jul 17, 2009 2:03 am Post subject: |
|
|
 Voyager
Joined: 28 May 2009 Posts: 75 Location: London, UK
|
I never worked with V6.
But I have one question - when we upgrade to V7, should the jars need to be upgraded too ? _________________ "I almost care !" |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 2:03 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
btw no FDC file is created. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Fri Jul 17, 2009 2:04 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
Do you have some old copies of any jars kicking around?
You dont say what OS you are using but if its windows you could try loading filemon and filtering on accesses to *.jar to check this. |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 2:13 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
now that I am using MQ 7 with the application, I recompiled the application against the MQ 7 jar files, and run the application using the MQ 7 jar files (I don't even have anything left from MQ 6 to run against after the upgrade).
it could very well be a classpath issue, though I find it odd that I had no errors in compiling or application startup (prior to attempting to the queue manager) - which seem to indicate the classpath has everything it needs....? |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 2:15 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
sorry - I am on Windows XP SP3. running both MQ server + application on the same machine.
the old jar files don't seem to be enough - I tried by manually copying the ncessary MQ 6 jar files, but it complained about some dll not being available, so seems to be more required on Windows. |
|
Back to top |
|
 |
anilit99 |
Posted: Fri Jul 17, 2009 2:19 am Post subject: |
|
|
 Voyager
Joined: 28 May 2009 Posts: 75 Location: London, UK
|
Please make sure that you upgraded all jars to the newest version. and remove the old ones from the classpath.
there is an easy way to do this. Just start your application with -verbose parameter on java.exe. It will surely generate a whole lot of log, but within the first few lines you can check what are jar files its loading.
Code: |
java -verbose main.class |
NoSuchMethodError is obviously an error (!) a runtime error and not an exception, so you wont be hitting it until you execute that part of the code.
Compilation and starting up wont be a problem at all. _________________ "I almost care !" |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 2:31 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
I am certain that I only have MQ 7 jar files in my classpath. The test I mentioned with MQ 6 was just tried once and the old jars were immediately deleted.
I can certainly set '-verbose' - but that just tells me what classes I am loading, not what classes (if any?) are missing?
I mean, part of the error was:
java.lang.NoSuchMethodException[com.ibm.mq.jmqi.local.LocalServer
the com.ibm.mq.jmqi.local.LocalServer class is in com.ibm.mq.jmqi.jar which is in my classpath
and -verbose output does indicate that the class is loaded
[Loaded com.ibm.mq.jmqi.local.LocalServer from file:/C:/MQ70/java/lib/com.ibm.mq.jmqi.jar]
or am I looking at this the wrong way? |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Fri Jul 17, 2009 2:53 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
zvirbulis wrote: |
the old jar files don't seem to be enough - I tried by manually copying the ncessary MQ 6 jar files, but it complained about some dll not being available, so seems to be more required on Windows. |
This wasnt what I was suggesting and I really recommend against using the old v6 jars in place of the newer ones.
I still think its worth checking which .jars are loaded using filemon, just in case theres any lieing around that you dont know about. |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 3:04 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
I'll take a look at filemon but I can confirm that no MQ 6 jars are being used - only MQ 7 jar files.
My classpath is explicitly defined to only point to the 3 MQ jar files I mentioned earlier. No other MQ jar files are being used. |
|
Back to top |
|
 |
anilit99 |
Posted: Fri Jul 17, 2009 3:08 am Post subject: |
|
|
 Voyager
Joined: 28 May 2009 Posts: 75 Location: London, UK
|
well, at this point I have nothing to add, except if you can post the code, I can try it in my machine.
(Its friday noon here, and am in no mood to work ) _________________ "I almost care !" |
|
Back to top |
|
 |
zvirbulis |
Posted: Fri Jul 17, 2009 3:37 am Post subject: |
|
|
Novice
Joined: 16 Jul 2009 Posts: 14
|
well here's the odd thing - the same code works as a separate application, but within our code, it fails with the 2298.
I stole this sample app from another post here. run separately, it works fine. embed it deep in our code, and it fails with 2298.
that I think is the main clue as to the problem - why would the same code work in one place and not in another? Have tried with Java 1.5 and 1.6, same results.
and why does it say it can't find the com.ibm.mq.jmqi.local.LocalServer method when it clearly loads it in the verbose output?
just very, very bizarre stuff. Looks like we'll have to stick with MQ 6!
here's the sample app, just for reference.
-----
import com.ibm.mq.*;
public class MQSample {
public static void main(String args[]) {
try {
MQQueueManager qMgr = new MQQueueManager("QMGR");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
MQQueue local_queue = qMgr.accessQueue("SOURCEQUEUE", openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
MQPutMessageOptions pmo = new MQPutMessageOptions();
local_queue.put(hello_world, pmo);
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
local_queue.get(retrievedMessage, gmo);
String msgText = retrievedMessage.readUTF();
System.out.println("The message is: " + msgText);
local_queue.close();
qMgr.disconnect();
} catch (MQException ex) {
System.out
.println("A WebSphere MQ error occurred : Completion code "
+ ex.completionCode + " Reason code "
+ ex.reasonCode);
} catch (java.io.IOException ex) {
System.out.println("An error occurred whilst writing to the message buffer: "
+ ex);
}
}
} |
|
Back to top |
|
 |
|