Troubleshooting
Problem
In WebSphere® Application Server, the following exception might occur when an application attempts to do a Java™ Naming and Directory Interface (JNDI) lookup of a queue connection factory that is defined under the WebSphere MQ Java Message Service (JMS) provider:
[]
java.lang.ClassCastException: com/ibm/ejs/jms/JMSConnectionFactoryHandle incompatible with javax/jms/QueueConnectionFactory
[
]
Cause
The ClassCastException occurs when a queue connection factory is defined as a WebSphere MQ Connection Factory instead of a WebSphere MQ Queue Connection Factory.
The application code is similar to the following example:
javax.jms.QueueConnectionFactory myQCF = null;
InitialContext ic = null;
//... setup InitialContext here ...
try
{
myQCF = (QueueConnectionFactory)ic.lookup("jms/myQCF");
}
catch(Throwable e)
{
e.printStackTrace();
}
Resolving The Problem
You can resolve the problem using one of the following methods:
- Define the queue connection factory as a WebSphere MQ Queue Connection Factory.
- Use a javax.jms.ConnectionFactory object in the application code rather than a javax.jms.QueueConnectionFactory object.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21238470