PageFile is not loaded
スケジュールされたメッセージを生成すると、実稼働環境で例外が発生します。Webで検索しても解決策が見つからなかった後、本番環境をシミュレートするための簡単なプログラムを作成しました。プログラムを示し、スロー例外のシナリオを説明します。
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: OpenWireFormat{version=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: OpenWireFormat{version=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
バージョンで動作します。