使用ActiveMQ 5.9.0,我具有以下代理配置:

<amq:broker id="broker" useShutdownHook="false" persistent="true">
    <amq:persistenceAdapter>
        <amq:jdbcPersistenceAdapter dataSource="#dataSource">
        </amq:jdbcPersistenceAdapter>
    </amq:persistenceAdapter>
    <amq:transportConnectors>
        <amq:transportConnector uri="${broker.url}" />
    </amq:transportConnectors>
</amq:broker>

如果启动代理时数据库中已经有消息,则会出现异常:

java.lang.ClassCastException:
org.apache.activemq.command.WireFormatInfo无法转换为
org.apache.activemq.command.Message位于
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getLastMessageBrokerSequenceId(JDBCPersistenceAdapter.java:265)

org.apache.activemq.broker.region.DestinationFactoryImpl.getLastMessageBrokerSequenceId(DestinationFactoryImpl.java:147)

org.apache.activemq.broker.region.RegionBroker。(RegionBroker.java:128)

org.apache.activemq.broker.jmx.ManagedRegionBroker。(ManagedRegionBroker.java:111)

org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:2172)

org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:2165)

org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:2122)

org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:906)

org.apache.activemq.broker.BrokerService.getAdminConnectionContext(BrokerService.java:2393)

org.apache.activemq.broker.BrokerService.startVirtualConsumerDestinations(BrokerService.java:2533)

org.apache.activemq.broker.BrokerService.startDestinations(BrokerService.java:2384)

org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:640)

org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:632)

org.apache.activemq.broker.BrokerService.start(BrokerService.java:568)

org.apache.activemq.broker.BrokerService.autoStart(BrokerService.java:524)

org.apache.activemq.broker.BrokerService.postConstruct(BrokerService.java:511)

在我看来,封送邮件所用的格式可能与解组邮件时所用的格式不同。知道为什么会这样吗?

最佳答案

问题是oracle驱动程序版本。从数据库读取Blob列时,数据已损坏。
该问题很难重现(在收到消息时停止应用程序),因此切换到amq 5.5.0是误报。我正在使用ojdbc 10.1.0.2.0并切换到ojdbc6 11.2.0.3解决了该问题。

07-24 22:32