Skip to main content

SonicMQ XMLMessage generated ClassCastException

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

  • Product Name: BES-AppServer
  • Product Version: 5.2.1
  • Product Component: SonicMQ
  • Platform/OS Version: All
  • JDK/Compiler Version: 1.3.1 and 1.4.1

The following line:

progress.message.jclient.XMLMessage xMsg = ((progress.message.jclient.Session) tSess).createXMLMessage();

will generate a ClassCastException if JNDI Logical Names are used.

Resolution:

To use proprietary methods in the Sonic objects like "createXMLMessage", then Sonic tcf has to be used, obtained directly using "serial://" (as defined in jndi-definitions.xml), not by Logical Name (i.e. java:comp/).

Exception is occurring in the cast of "tSess" to "progress.message.jclient.Session" because "tSess" is actually of class "com.inprise.visitransact.jms.TopicSessionProxy".

When a logical name "java:comp/env/jms/tcf" BES wraps the requested object in a wrapper class to provide added functionality (e.g. connection pooling) the wrapper lookups directly against the serial provider "serial://jms/tcf", return what's defined in jndi-definitions, which in this case is the Sonic connection factory object.

 


#ClassCastException
#VisiBroker
#JMS
#SonicMQ
#AppServer
#Security