Exception in thread "main" javax.jms.JMSException: Disposed due to prior exception
	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
	at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1421)
	at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1486)
	at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:329)
	at com.mine.demo.activemq.service.ActivemqProducerService.sendMessage(ActivemqProducerService.java:19)
	at com.mine.demo.MainClass.main(MainClass.java:9)
Caused by: org.apache.activemq.transport.TransportDisposedIOException: Disposed due to prior exception
	at org.apache.activemq.transport.ResponseCorrelator.onException(ResponseCorrelator.java:125)
	at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:114)
	at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:114)
	at org.apache.activemq.transport.WireFormatNegotiator.onException(WireFormatNegotiator.java:173)
	at org.apache.activemq.transport.AbstractInactivityMonitor.onException(AbstractInactivityMonitor.java:345)
	at org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:96)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:219)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Unknown data type: 47
	at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:359)
	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:278)
	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:240)
	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:232)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)
	... 1 more

操作ActiveMQ时,出现以上错误

解决方法

原来URL写的tcp://127.0.0.1:8161

ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(
                ActiveMQConnectionFactory.DEFAULT_USER,
                ActiveMQConnectionFactory.DEFAULT_PASSWORD,
                "tcp://127.0.0.1:8161");

改成

ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(
                ActiveMQConnectionFactory.DEFAULT_USER,
                ActiveMQConnectionFactory.DEFAULT_PASSWORD,
                "tcp://127.0.0.1:61616");

即可解决

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐