java.lang.ClassCastException: com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory cannot be cast to javax.jms.XAConnectionFactory
michelle.xiao Sep 5, 2017 3:55 PMWhen migrating an enterprise application from Weblogic Server to JBoss EAP 6.4, we encountered the following error:
connectionFactory=java:global/remoteJMS/QueueConnectionFactory): java.lang.ClassCastException: com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory cannot be cast to javax.jms.XAConnectionFactory
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupConnection(JmsActivation.java:437)
We use Tibco EMS as JMS provider.
Below is the my-jms-jms.xml configuration file in Weblogic Server:
[[
<weblogic-jms ...>
<foreign-server name="myForeignServer">
<default-targeting-enabled>true</default-targeting-enabled>
<foreign-destination name="My_MG">
<local-jndi-name>My_MG</local-jndi-name>
<remote-jndi-name>My_MG</remote-jndi-name>
</foreign-destination>
<foreign-connection-factory name="TopicConnectionFactory">
<local-jndi-name>TopicConnectionFactory</local-jndi-name>
<remote-jndi-name>TopicConnectionFactory</remote-jndi-name>
<username>{myUsername}</username>
<password-encrypted>{myPassword}</password-encrypted>
</foreign-connection-factory>
<foreign-connection-factory name="QueueConnectionFactory">
<local-jndi-name>QueueConnectionFactory</local-jndi-name>
<remote-jndi-name>QueueConnectionFactory</remote-jndi-name>
<username>{myUsername}</username>
<password-encrypted>{myPassword}</password-encrypted>
</foreign-connection-factory>
<initial-context-factory>com.tibco.tibjms.naming.TibjmsInitialContextFactory</initial-context-factory>
<connection-url>tcp://server1:42032,tcp://server1:42033</connection-url>
<jndi-properties-credential-encrypted>{myPassword}</jndi-properties-credential-encrypted>
<jndi-property>
<key>java.naming.provider.url</key>
<value>tcp://server1:42032,tcp://server1:42033</value>
</jndi-property>
<jndi-property>
<key>java.naming.factory.initial</key>
<value>com.tibco.tibjms.naming.TibjmsInitialContextFactory</value>
</jndi-property>
<jndi-property>
<key>java.naming.security.principal</key>
<value>{myUsername}</value>
</jndi-property>
</foreign-server>
</weblogic-jms>
]]
Below is how it is configured in standalone-full.xml:
[[
<subsystem xmlns="urn:jboss:domain:naming:1.4">
<bindings>
<external-context name="java:global/remoteJMS/" module="org.jboss.genericjms.provider" class="javax.naming.InitialContext">
<environment>
<property name="java.naming.factory.initial" value="com.tibco.tibjms.naming.TibjmsInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://server1:42032,tcp://server1:42033"/>
<property name="java.naming.factory.url.pkgs" value="com.tibco.tibjms.naming"/>
<property name="java.naming.security.principal" value="{myUsername}"/>
<property name="java.naming.security.credentials" value="{myPassword}"/>
<property name="org.jboss.as.naming.lookup.by.string" value="true"/>
</environment>
</external-context>
</bindings>
<remote-naming/>
</subsystem>
....
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
<resource-adapters>
<resource-adapter id="org.jboss.genericjms">
<module slot="main" id="org.jboss.genericjms"/>
<transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory" jndi-name="java:/jms/XAQCF" pool-name="XAQCF">
<config-property name="JndiParameters">
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url=tcp://server1:42032,tcp://server1:42033;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;java.naming.security.principal={myUsername};java.naming.security.credentials={myPassword}
</config-property>
<config-property name="ConnectionFactory">
XAQCF
</config-property>
<security>
<application/>
</security>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
]]
Below is the jboss-ejb3.xml for MDB:
[[
<jboss:ejb-jar ...>
<enterprise-beans>
<message-driven>
<ejb-name>MyMDB</ejb-name>
<activation-config>
<activation-config-property>
<activation-config-property-name>connectionFactory</activation-config-property-name>
<activation-config-property-value>java:global/remoteJMS/QueueConnectionFactory</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>java:global/remoteJMS/My_MG</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</jboss:ejb-jar>
]]
Please help to see what may have caused this error? Thank you very much in advance.