ClassCastException: weblogic.jms.client.JMSConnection не может быть приведен к weblogic.jms.client.JMSXAConnection
Мы переносим приложение с Weblogic 10 на Weblogic 12. По какой-то причине мы не можем подключиться к чужой теме JMS, и единственная информация, которую мы получаем после развертывания EAR в нашей среде DEV, это
ClassCastException: weblogic.jms.client.JMSConnection cannot be cast to weblogic.jms.client.JMSXAConnection
В среде ACC мы получаем другое (но несколько похожее исключение)
[EJB:015027]The Message-Driven EJB is transactional, but the JMS connection factory referenced by the JNDI name aaa.ChangeSignalConnectionFactory is not a JMS XA connection factory.>
В обеих средах работает Weblogic 12.1.3.0.0
Та же конфигурация отлично работала на Weblogic 10 до перехода с Weblogic 10 (и Java6 + OpenJPA1) на Weblogic 12 (и Java7 + OpenJPA2)
Наш MDB теперь выглядит так (без аннотаций или чего-то еще, это просто пустая оболочка, которая вообще ничего не делает, и даже это не работает)
public class SignalConsumerMDB implements MessageListener {
@Override
public void onMessage(Message message) {
}
}
Ejb-jar.xml выглядит так
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>SignalConsumerMDB</ejb-name>
<ejb-class>a.b.c.SignalConsumerMDB</ejb-class>
<transaction-type>Bean</transaction-type>
<activation-config>
<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-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>subscriptionDurability</activation-config-property-name>
<activation-config-property-value>Durable</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>topicMessagesDistributionMode</activation-config-property-name>
<activation-config-property-value>One-Copy-Per-Application</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>distributedDestinationConnection</activation-config-property-name>
<activation-config-property-value>LocalOnly</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>messageSelector</activation-config-property-name>
<activation-config-property-value>SignalType in ('a','b','c')</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<role-name>batchRole</role-name>
</security-role>
</assembly-descriptor>
</ejb-jar>
Файл weblogic-ejb-jar.xml выглядит следующим образом (здесь показан только MDB)
<weblogic-enterprise-bean>
<ejb-name>SignalConsumerMDB</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>foreign.aaa.ChangeSignal</destination-jndi-name>
<connection-factory-jndi-name>foreign.aaa.ChangeSignalConnectionFactory</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
В нашей базе данных используются источники com.ibm.db2.jcc.DB2Driver
(не xa) водитель и Supports Global Transactions
отключен в консоли weblogic.
Наш файл persistence.xml выглядит следующим образом
<persistence-unit name="aaa" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>ABCDataSource</jta-data-source>
<properties>
<property name="connection.driver_class" value="com.ibm.db2.jcc.DB2Driver" />
<property name="openjpa.TransactionMode" value="managed" />
<property name="openjpa.ManagedRuntime" value="jndi(TransactionManagerName=javax.transaction.TransactionManager)" />
<property name="openjpa.Log" value="DefaultLevel=${openjpa.log.level}, Runtime=${openjpa.log.level}, Tool=${openjpa.log.level}, SQL=${openjpa.sql.level}" />
<property name="openjpa.Compatibility" value="CheckDatabaseForCascadePersistToDetachedEntity=true" />
<property name="openjpa.jdbc.DBDictionary" value="db2(MaxColumnNameLength=38)"/>
</properties>
</persistence-unit>
Вывод отладочной веб-логики для JMS:
DDMemberInformation :
DD Type = javax.jms.Topic
DD ForwardingPolicy = 1
DD Config Name = aaa.ChangeSignal!ChangeSignalDistributed
DD JNDI Name = aaa.ChangeSignal
DD Member JNDI Name = JMSapp4Zjavad011@aaa.ChangeSignal
DD Member Name = aaa.ChangeSignal!JMSapp4Zjavad011@ChangeSignalDistributed
DD Member Consumption Paused = false
DD Member Insertion Paused = false
DD Member Production Paused = false
DD Member Local JNDI Name = null
DD Member Server Name = app4Zjavad011
DD Member Cluster Name = app1Cluster
DD Member Migratable Target Name = null
DD Member Domain Name = wldev81domain
DD Member AdvancedTopicSupported = true
####<Apr 21, 2017 10:19:56 AM CEST> <Debug> <JMSCDS> <zjavad12> <app1Zjavad121> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1492762796912> <BEA-000000> <Entry[1] = aaa.ChangeSignal!JMSapp1Zjavad011@ChangeSignalDistributed: with destination id <4007994051863776153.25>:
DDMemberInformation :
DD Type = javax.jms.Topic
DD ForwardingPolicy = 1
DD Config Name = aaa.ChangeSignal!ChangeSignalDistributed
DD JNDI Name = aaa.ChangeSignal
DD Member JNDI Name = JMSapp1Zjavad011@aaa.ChangeSignal
DD Member Name = aaa.ChangeSignal!JMSapp1Zjavad011@ChangeSignalDistributed
DD Member Consumption Paused = false
DD Member Insertion Paused = false
DD Member Production Paused = false
DD Member Local JNDI Name = null
DD Member Server Name = app1Zjavad011
DD Member Cluster Name = app1Cluster
DD Member Migratable Target Name = null
DD Member Domain Name = wldev81domain
DD Member AdvancedTopicSupported = true