然后在一段时间(大约1-5秒)后开始获取没有问题的消息.我正在使用具有非常基本配置的Spring Boot 2.0.4:spring.activemq.broker-url=tcp://localhost:61616spring.activemq.user=adminspring.activemq.password=adminspring.activemq.packages.trust-all=true 我使用了JmsTemplate,现在使用了spring集成,可悲的是错误是相同的.org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connectat org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:311) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:185) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:507) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:661) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:650) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.jms.AbstractJmsChannel.doSend(AbstractJmsChannel.java:49) ~[spring-integration-jms-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:426) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:336) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:227) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:150) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:142) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.gateway.MessagingGatewaySupport.send(MessagingGatewaySupport.java:415) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:528) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:469) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:460) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.8.RELEASE.jar:5.0.8.RELEASE]什么会导致这种类型的错误,我在activemq日志中看不到任何东西,但是错误仍然存​​在.解决方案解决方案是添加org.apache.activemq:activemq-pool并配置PooledConnectionFactory: spring.activemq.pool.enabled=true spring.activemq.pool.max-connections=50 在Spring Boot中启用池还不够,因为自动配置会检查依赖关系.ActiveMQ gives: "javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connect" after around 10 000 messagesThen after a some time (around 1-5 seconds) start to get messages with no issue.I'm using Spring Boot 2.0.4 with very basic configuration:spring.activemq.broker-url=tcp://localhost:61616spring.activemq.user=adminspring.activemq.password=adminspring.activemq.packages.trust-all=trueI used JmsTemplate and now using spring integration, sadly the error is the same.org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connectat org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:311) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:185) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:507) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:584) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:661) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:650) ~[spring-jms-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.jms.AbstractJmsChannel.doSend(AbstractJmsChannel.java:49) ~[spring-integration-jms-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:426) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:336) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:227) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:150) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:142) ~[spring-messaging-5.0.8.RELEASE.jar:5.0.8.RELEASE]at org.springframework.integration.gateway.MessagingGatewaySupport.send(MessagingGatewaySupport.java:415) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:528) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:469) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:460) ~[spring-integration-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.8.RELEASE.jar:5.0.8.RELEASE]What can cause this type of error, i dont see anything in activemq logs, but error is persistent. 解决方案 The resolution was adding org.apache.activemq:activemq-pool and configuring the PooledConnectionFactory:spring.activemq.pool.enabled=true spring.activemq.pool.max-connections=50Enabling pool is not enough in Spring Boot as autoconfiguration checks for dependency. 这篇关于ActiveMQ给出:“无法连接到代理URL:tcp://localhost:61616"在大约1万条消息之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-22 20:48