org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed
activemq-classic, apache-camel, java
Solution
- management port: 61616 (default)
- service port : 8161(default)
change your broker url port to 61616 and run
refer this
Problem
I am using apache's activemq for queueing. We have started to see the following exception very often when writing things to the queue: ``` Caused by: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: at org.apache.activemq.transport.AbstractInactivityMonitor.doOnewaySend(AbstractInactivityMonitor.java:282) at org.apache.activemq.transport.AbstractInactivityMonitor.oneway(AbstractInactivityMonitor.java:271) at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:85) at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:104) at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68) at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81) at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1366) ``` I can't figure out what could be causing this-- or even, frankly, where to start debugging what is causing this. Here is the queue set up code: ``` camelContext = new DefaultCamelContext(); camelContext.setErrorHandlerBuilder(new LoggingErrorHandlerBuilder()); camelContext.getShutdownStrategy().setTimeout(SHUTDOWN_TIMEOUT_SECONDS); routePolicy = new RoutePolicy(); routePolicy.setCamelContext(camelContext); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(queueUri); // use a pooled connection factory between the module and the queue pooledConnectionFactory = new PooledConnectionFactory(connectionFactory); // how many connections should there be in the session pool? pooledConnectionFactory.setMaxConnections(this.maxConnections); pooledConnectionFactory.setMaximumActiveSessionPerConnection(this.maxActiveSessionPerConnection); pooledConnectionFactory.setCreateConnectionOnStartup(true); pooledConnectionFactory.setBlockIfSessionPoolIsFull(false); JmsConfiguration jmsConfiguration = new JmsConfiguration(pooledConnectionFactory); jmsConfiguration.setDeliveryPersistent(false); // do not store a copy of the messages on the queue ActiveMQComponent activeMQComponent = ActiveMQComponent.activeMQComponent(queueUri); activeMQComponent.setConfiguration(jmsConfiguration); camelContext.addComponent("activemq", activeMQComponent); Component activemq = camelContext.getComponent("activemq"); // register endpoints for queues and topics Endpoint queueEndpoint = activemq.createEndpoint("activemq:queue:polaris.*"); Endpoint topicEndpoint = activemq.createEndpoint("activemq:topic:polaris.*"); producerTemplate = camelContext.createProducerTemplate(); camelContext.start(); queueEndpoint.start(); topicEndpoint.start(); ``` Like I said, the error doesn't suggest any directions for debugging, and it doesn't happen in 100% of cases where I can be sure my configuration is not set up correctly.