gpt4 book ai didi

java - org.apache.activemq.transport.InactivityIOException : Cannot send, channel 已经失败

转载 作者:搜寻专家 更新时间:2023-11-01 03:37:19 27 4
gpt4 key购买 nike

我正在使用 apache 的 activemq 进行排队。在向队列写入内容时,我们开始经常看到以下异常:

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)

我无法弄清楚是什么导致了这种情况——甚至,坦率地说,我什至不知道从哪里开始调试导致这种情况的原因。

这里是队列设置代码:

    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();

就像我说的那样,该错误不建议任何调试方向,并且在我可以确定我的配置设置不正确的 100% 情况下不会发生这种情况。

最佳答案

最近我遇到了同样的问题。我找到了这个 https://issues.apache.org/jira/browse/AMQ-6600

当类路径中缺少其中一个 jar 时,Apache ActiveMQ 客户端会抛出 InactivityIOException。在我的例子中,它是 hawtbuf-1.11.jar。当我将这个 jar 添加到类路径时,它开始正常工作。

关于java - org.apache.activemq.transport.InactivityIOException : Cannot send, channel 已经失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27113501/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com