在activemq中没有加载PageFile异常

Posted

技术标签:

【中文标题】在activemq中没有加载PageFile异常【英文标题】:PageFile is not loaded exception in activemq 【发布时间】:2013-01-29 00:25:40 【问题描述】:

我在生产环境中收到PageFile is not loaded 异常以生成预定消息。在网上搜索并没有找到任何解决方案后,我编写了一个用于模拟生产环境的简单程序。我展示了我的程序并解释了抛出异常的场景:

public static void main(String[] args) throws Throwable

    final ActiveMQConnectionFactory conFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
    final QueueConnection connection = conFactory.createQueueConnection();
    final Session session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    final Destination destination = new ActiveMQQueue("MJ_SAF");
    final MessageProducer producer = session.createProducer(destination);

    ActiveMQMessage message = (ActiveMQMessage) session.createTextMessage("Hello World!");
    message.setPersistent(true);
    message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, 1000);
    message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD, 0);
    message.setIntProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT, 1);
    producer.send(message);

    producer.close();
    session.close();
    connection.close();

执行此代码后,当消息在调度队列中并且不发送主队列(MJ_SAF)时,我删除了MJ_SAF。然后我再次运行上面的程序,但出现以下异常:

DEBUG  [main] o.a.a.transport.WireFormatNegotiator - Sending: WireFormatInfo  version=9, properties=MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true, magic=[A,c,t,i,v,e,M,Q]
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.InactivityMonitor - Using min of local: WireFormatInfo  version=9, properties=MaxFrameSize=9223372036854775807, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true, magic=[A,c,t,i,v,e,M,Q] and remote: WireFormatInfo  version=9, properties=CacheSize=1024, MaxFrameSize=9223372036854775807, CacheEnabled=true, SizePrefixDisabled=false, TcpNoDelayEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true, magic=[A,c,t,i,v,e,M,Q]
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - Received WireFormat: WireFormatInfo  version=9, properties=CacheSize=1024, MaxFrameSize=9223372036854775807, CacheEnabled=true, SizePrefixDisabled=false, TcpNoDelayEnabled=true, MaxInactivityDurationInitalDelay=10000, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true, magic=[A,c,t,i,v,e,M,Q]
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - tcp://localhost/127.0.0.1:61616@2422 before negotiation: OpenWireFormatversion=9, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false, maxFrameSize=9223372036854775807
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.a.transport.WireFormatNegotiator - tcp://localhost/127.0.0.1:61616@2422 after negotiation: OpenWireFormatversion=9, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false, maxFrameSize=9223372036854775807
DEBUG  [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@2422] o.a.activemq.util.ThreadPoolUtils - Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@2f48d2 is shutdown: true and terminated: true took: 0.000 seconds.
DEBUG  [main] o.a.activemq.util.ThreadPoolUtils - Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@296f76 is shutdown: true and terminated: false took: 0.000 seconds.
DEBUG  [main] o.a.a.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616@2422
DEBUG  [ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:61616@2422] o.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.lang.IllegalStateException: PageFile is not loaded
java.lang.IllegalStateException: PageFile is not loaded
    at org.apache.kahadb.page.PageFile.assertLoaded(PageFile.java:809) ~[kahadb-5.7.0.jar:5.7.0]
    at org.apache.kahadb.page.PageFile.tx(PageFile.java:303) ~[kahadb-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore.getMessageCount(KahaDBStore.java:479) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:101) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.store.ProxyMessageStore.getMessageCount(ProxyMessageStore.java:101) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.Queue.initialize(Queue.java:376) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.DestinationFactoryImpl.createDestination(DestinationFactoryImpl.java:86) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.AbstractRegion.createDestination(AbstractRegion.java:532) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.jmx.ManagedQueueRegion.createDestination(ManagedQueueRegion.java:56) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:137) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:283) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:151) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.region.RegionBroker.addProducer(RegionBroker.java:361) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.jmx.ManagedRegionBroker.addProducer(ManagedRegionBroker.java:281) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:93) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.CompositeDestinationBroker.addProducer(CompositeDestinationBroker.java:56) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:93) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:99) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:511) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:152) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:256) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:222) ~[activemq-core-5.7.0.jar:5.7.0]
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204) ~[activemq-core-5.7.0.jar:5.7.0]
    at java.lang.Thread.run(Thread.java:662) ~[na:1.6.0_13]
DEBUG  [main] o.a.a.thread.TaskRunnerFactory - Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: java.util.concurrent.ThreadPoolExecutor@6295eb
DEBUG  [ActiveMQ Task-1] o.a.a.transport.tcp.TcpTransport - Closed socket Socket[addr=localhost/127.0.0.1,port=61616,localport=2422]
DEBUG  [main] o.a.activemq.util.ThreadPoolUtils - Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@6295eb

我使用Apache ActiveMQ 5.7 版本。

【问题讨论】:

我会用更新的版本 v5.8.0 重新测试,因为其中包含了几个与这些类型的错误相关的 KahaDB 修复。 @TimBish 很好的答案。是的,您的回答解决了我的情况,请写下您的评论作为答案,我会接受的。谢谢。 【参考方案1】:

ActiveMQ 中的 KahaDB 经历了最近几个版本的大量强化工作。我记得在这个领域修复了一些问题,即在使用的分页列表和树中,由于竞争条件可能导致这样的异常。最新版本 v5.8.0 刚刚发布,其中包含我们使用 KahaDB 完成的所有最新工作,我建议用户尽快迁移到该版本。

【讨论】:

以上是关于在activemq中没有加载PageFile异常的主要内容,如果未能解决你的问题,请参考以下文章

activemq启动异常

怎么清除虚拟内存?pagefile.sys

如何用命令行设置Windows的pagefile.sys

ActiveMQ抛出异常javax.jms.IllegalStateException: The Session is closed

错误: 找不到或无法加载主类 Files\apache-activemq-5.10.0\bin\..\conf\login.config

spring+activemq中多个consumer同时处理消息时遇到的性能问题