ClassCastException:weblogic.jms.client.JMSConnection无法强制转换为weblogic.jms.client.JMSXAConnection

时间:2017-04-21 09:45:47

标签: jms weblogic weblogic12c xa jms-topic

我们正在将应用程序从Weblogic 10迁移到Weblogic 12.由于某种原因,我们无法连接到外部JMS主题,我们在DEV环境中部署EAR后获得的唯一信息是< / p>

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(和Java6 + OpenJPA1)迁移到Weblogic 12(和Java7 + OpenJPA2)之前,相同的配置在Weblogic 10上完美运行

我们的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)驱动程序,并且在weblogic控制台中禁用了Supports Global Transactions

我们的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的weblogic调试输出是

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

0 个答案:

没有答案