"JMSException: Timer already cancelled"

Solution Unverified - Updated -

Issue

  1. We have a Camel route which receives requests from Web Service clients and enqueues these messages in an ActiveMQ queue. On one run the exception below was raised. What's wrong?
qtp660557318-2039 - /event/Customer_Services/Pin;com.example.DefaultIntegrationManager(DefaultIntegrationManager.java:241);Pin;A communication exception for message with retentionId f08b27bdd59e45a617a961106c7f835c and body [com.example.service.Send@1a7998a8] has occurred in route com.example.receiver with origin Endpoint[cxf://bean:myService?headerFilterStrategy=%23ignoreAllHeaderFilterStrategy&synchronous=true] when calling CRM.
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Timer already cancelled.
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:170)
    at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:402)
    at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:356)
    at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:132)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.impl.InterceptSendToEndpoint$1.process(InterceptSendToEndpoint.java:164)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
    at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:334)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
    at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
    at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
    at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
    at org.apache.camel.component.cxf.CxfConsumer$1.syncInvoke(CxfConsumer.java:125)
    at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:75)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
    at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:231)
    at org.apache.cxf.interceptor.OneWayProcessorInterceptor.handleMessage(OneWayProcessorInterceptor.java:103)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:194)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:221)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:141)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:197)
    at sun.reflect.GeneratedMethodAccessor1155.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.ops4j.pax.web.service.internal.HttpServiceStarted$1.invoke(HttpServiceStarted.java:182)
    at org.ops4j.pax.web.service.internal.$Proxy35.service(Unknown Source)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447)
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:534)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:117)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:359)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.jms.JMSException: Timer already cancelled.
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1377)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1305)
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1795)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:277)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:212)
    at org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:79)
    at org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:62)
    at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:592)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSend(JmsConfiguration.java:278)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:217)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:159)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:173)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)
    ... 95 more
Caused by: java.lang.IllegalStateException: Timer already cancelled.
    at java.util.Timer.sched(Timer.java:397)
    at java.util.Timer.schedule(Timer.java:248)
    at org.apache.activemq.thread.Scheduler.schedualPeriodically(Scheduler.java:50)
    at org.apache.activemq.broker.region.Queue.start(Queue.java:885)
    at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:143)
    at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:283)
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145)
    at org.apache.activemq.advisory.AdvisoryBroker.addDestination(AdvisoryBroker.java:175)
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145)
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145)
    at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145)
    at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:151)
    at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:481)
    at org.apache.activemq.broker.jmx.ManagedRegionBroker.send(ManagedRegionBroker.java:311)
    at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
    at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96)
    at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:317)
    at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
    at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:135)
    at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:450)
    at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:680)
    at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294)
    at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:152)
    at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
    at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
    at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:256)
    at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:222)
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204)
    ... 1 more
  1. In some instances the ActiveMQ could also throws OutOfMemoryException with the following stacktrace
Exception in thread "ActiveMQ Broker[amq] Scheduler" java.lang.OutOfMemoryError: Java heap space
        at org.apache.activemq.store.kahadb.disk.journal.DataFileAccessor.readRecord(DataFileAccessor.java:86)
        at org.apache.activemq.store.kahadb.disk.journal.Journal.read(Journal.java:668)
        at org.apache.activemq.store.kahadb.plist.PListStoreImpl.getPayload(PListStoreImpl.java:398)
        at org.apache.activemq.store.kahadb.plist.PListImpl$PListIteratorImpl.next(PListImpl.java:246)
        at org.apache.activemq.store.kahadb.plist.PListImpl$PListIteratorImpl.next(PListImpl.java:225)
        at org.apache.activemq.broker.region.cursors.FilePendingMessageCursor$DiskIterator.next(FilePendingMessageCursor.java:506)
        at org.apache.activemq.broker.region.cursors.FilePendingMessageCursor$DiskIterator.next(FilePendingMessageCursor.java:490)
        at org.apache.activemq.broker.region.cursors.FilePendingMessageCursor.next(FilePendingMessageCursor.java:311)
        at org.apache.activemq.broker.region.cursors.StoreQueueCursor.next(StoreQueueCursor.java:137)
        at org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1898)
        at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:2107)
        at org.apache.activemq.broker.region.Queue.doBrowse(Queue.java:1106)
        at org.apache.activemq.broker.region.Queue.expireMessages(Queue.java:899)
        at org.apache.activemq.broker.region.Queue.access$100(Queue.java:96)
        at org.apache.activemq.broker.region.Queue$2.run(Queue.java:139)
        at org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

Environment

Fuse ESB 7.1
JBoss Fuse 6.1
JBoss A-MQ 6.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content