2

I am trying to connect jms server using ActiveMQ from a stand alone java code but I am struggling with following exception. I tried various options but not able to figure out root cause.

It is failing at following line of code:

jmsConnection.start();

my broker url is:

tcp://localhost:7676?wireFormat.maxInactivityDuration=0

Stack Trace is as follows:

javax.jms.JMSException: Channel was inactive for too long: localhost/127.0.0.1:7676
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
        at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1206)
        at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1289)
        at org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:456)
        at com.bt.ccdr.dbtoqueue.DBToQueueHelperImpl.getJMSConnection(DBToQueueHelperImpl.java:172)
        at com.bt.ccdr.dbtoqueue.DBToQueueHelperImpl.main(DBToQueueHelperImpl.java:42)
Caused by: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too long: localhost/127.0.0.1:7676
        at org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:225)
        at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:83)
        at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:100)
        at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
        at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:74)
        at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:79)
        at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1195)
        ... 4 more
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
user2094445
  • 65
  • 1
  • 2
  • 7

1 Answers1

2

Change the connection sting to failover:(tcp://localhost:7676). The failover transport layers reconnect logic over the standard OpenWire tcp transport.

Jakub Korab
  • 4,974
  • 2
  • 24
  • 34
  • Thanks Jake, I have changes connection string as above. After this change I am getting following logs printed, Aug 13, 2013 6:45:47 PM org.apache.activemq.transport.failover.FailoverTransport doReconnect INFO: Successfully connected to tcp://localhost:7676 Aug 13, 2013 6:45:47 PM org.apache.activemq.transport.failover.FailoverTransport handleTransportFailure WARNING: Transport failed to tcp://localhost:7676 , attempting to automatically reconnect due to: java.io.IOException: Unknown data type: 99 – user2094445 Aug 13 '13 at 10:43
  • This sounds like some sort of wire format mismatch. Are you using the same version of ActiveMQ client library as the broker? More to the point, are you using an ActiveMQ broker at all? 7676 is the default port used by OpenMQ, which needs the OpenMQ JMS library and not the ActiveMQ one. – Jakub Korab Aug 13 '13 at 12:31
  • 1
    Thanks Jake, I am quite new to JMS and your hint helped me a lot. Using openMQ API i am able to connect and send messages to queue. Thanks a lot again!!!! – user2094445 Aug 14 '13 at 03:08