InvalidDestinationException: MQJMS0003: Destination not understood or no longer valid

 

网上几点总结:
①=======================================================================================
Question 4: A WSAS administrator notices the following error in the SystemOut.log:

javax.jms.InvalidDestinationException:
MQJMS0003: Destination not understood or no longer valid.

Which of the following could have caused this error?

A. The JMS destination requires IIOP protocol for access. The JMS client is using the default JMS message protocol.
B. The JMS destination is running on a non-WebSphere environment.
C. The JMS destination was accidentally deleted.
D. The JNDI binding to the destination was changed.
E. The JMS destination is listening on a non standard TCP port.
me: http://www-1.ibm.com/support/docview.wss?uid=swg1IY60708
PROBLEM SUMMARY:
This problem is caused by using JMS interfaces to access MQ JMS
classes (i.e. casting a com.ibm.mq.MQQueue to a
javax.jms.Queue).

The use of an (instanceof MQQueue) test was returning false
when an MQQueue object had been cast as a javax.jms.Queue. The
logic then treated this as an invalid object, and threw an
InvalidDestinationException.

②=======================================================================================
MQJMS0003    Destination not understood or no longer valid.

Explanation: The queue or topic may have become unavailable, the application may be using an incorrect connection for the queue or topic, or the

supplied destination is not of the correct type for this method.
User Response: Check that WebSphere MQ is still running and the queue manager is available. Check that the right connection is being used for your

queue or topic.

③=======================================================================================
The problem is the IBM class com.ibm.mq.jms.MQSession.createQSender has the following code

**************************************************************************************************************************************************
if(!(queue instanceof com.ibm.mq.jms.MQQueue))
{
String s1 = "MQJMS0003";
String s3 = ConfigEnvironment.getErrorMessage(s1);
s3 = s3 + buildExceptionString(queue);
InvalidDestinationException invaliddestinationexception = new InvalidDestinationException(s3, s1);
throw invaliddestinationexception;
}
mqqueue = (com.ibm.mq.jms.MQQueue)queue;
mqqueue1 = getServicesMgr().getOutputQueue(mqqueue, this);
}
**************************************************************************************************************************************************
At first all looks straight for ward but there is a bigger problem.

instanceOf operator of java would return false for objects of the same class if they are being loaded by different classloaders.

In my case i had many webapplications and the Queue object was got by a jndi lookup. Now when first time this code is executed it all works fine

for a application but when you start using anohter web application the same code fails and throws the InvalidDestinationException .

The reason being the 2 objects on which ibm code is doing instanceof are loaded by different classloaders.

The Solution to this problem is delete all the ibm jars (com.ibm.mq.jar and com.ibm.mqjms.jar) from individual web application and add these in

the servers lib directory. Now all instances are loaded by the server classloader and not by webappclassloaders .

This is a criptic issue which took me 2 days to figure out.

wfac错误原因:
配置的factory和destination是两个不同的实现,factory指向的是WAS MQ,而queue指向的是sonic MQ,所以出现此报错。


Total views.

© 2013 - 2024. All rights reserved.

Powered by Hydejack v6.6.1