(linux)activemq启动成功,但是jms调用失败问题

原创 2018年04月16日 16:36:53

问题描述:

activemq启动成功,但是java程序调用报错。

1.linux 环境下的hosts文件如下:


activemq安装目录下的activemq.xml文件如下:



2.activemq启动成功如下:


3.访问页面成功:



4.报错信息如下:

2018-04-16 16:19:23,407 DEBUG [org.apache.activemq.util.ThreadPoolUtils] - Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@a12383f[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] is shutdown: true and terminated: true took: 0.000 seconds.
2018-04-16 16:19:23,414 DEBUG [org.apache.activemq.transport.tcp.TcpTransport] - Stopping transport tcp://192.168.116.132:61616
2018-04-16 16:19:23,423 DEBUG [org.apache.activemq.thread.TaskRunnerFactory] - Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: java.util.concurrent.ThreadPoolExecutor@6d782c0e[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
2018-04-16 16:19:23,425 DEBUG [org.apache.activemq.transport.tcp.TcpTransport] - Closed socket Socket[unconnected]
2018-04-16 16:19:23,426 DEBUG [org.apache.activemq.util.ThreadPoolUtils] - Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@6d782c0e[Running, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 1]
2018-04-16 16:19:28,696 DEBUG [org.mybatis.spring.SqlSessionUtils] - Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1c5e47e5]
2018-04-16 16:19:28,696 DEBUG [org.mybatis.spring.SqlSessionUtils] - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1c5e47e5]
2018-04-16 16:19:28,696 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager] - Initiating transaction rollback
2018-04-16 16:19:28,696 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager] - Rolling back JDBC transaction on Connection [com.mysql.jdbc.JDBC4Connection@66c1ff4d]
2018-04-16 16:19:28,703 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager] - Releasing JDBC Connection [com.mysql.jdbc.JDBC4Connection@66c1ff4d] after transaction
2018-04-16 16:19:28,703 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
2018-04-16 16:19:28,706 ERROR [com.alibaba.dubbo.rpc.filter.ExceptionFilter] -  [DUBBO] Got unchecked and undeclared exception which called by 192.168.43.19. service: cn.itcast.core.service.product.ProductService, method: isShow, exception: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://192.168.116.132:61616. Reason: java.net.ConnectException: Connection refused: connect, dubbo version: 2.5.3, current host: 127.0.0.1
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://192.168.116.132:61616. Reason: java.net.ConnectException: Connection refused: connect
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:496)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:579)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:562)
at cn.itcast.core.service.product.ProductServiceImpl.isShow(ProductServiceImpl.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy21.isShow(Unknown Source)
at com.alibaba.dubbo.common.bytecode.Wrapper5.invokeMethod(Wrapper5.java)
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://192.168.116.132:61616. Reason: java.net.ConnectException: Connection refused: connect
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:293)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:238)
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:184)
at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:365)
at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:305)
at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:283)
at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:224)
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
at org.springframework.jms.core.JmsTemplate.access$600(JmsTemplate.java:90)
at org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:1205)
at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:312)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:480)
... 43 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:75)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:496)
at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:459)
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:140)
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:273)
... 54 more

解决方案:

1.查询虚拟机的ipv4和ipv6地址:



2.修改hosts文件如下:



3.修改activemq.xml文件如下:





4.关闭防火墙:




原因分析:

activemq 读取 locahost时读不到 虚拟机的Ip ,所以将localhost 改为 本机的ip 



终于解决了,找个两天,各种方案都试过了,终于解决了!!!


项目实战:ActiveMQ开发大型分布式系统

消息中间件是搭建大型企业级项目必不可少的成员,只有掌握了消息中间件的使用和应用场景,才能开发真正的大型分布式系统。 ActiveMQ支持JMS,是apache的顶级项目,在全球开源消息中间件中影响力最大!
  • 2017年08月14日 15:46

cocos完整版改动列表

cocos2d-x-3.13 Aug 22 2016       [HIGHLIGHT] add VR plugin   [HIGHLIGHT] sup...
  • Anzhongliu
  • Anzhongliu
  • 2016-08-31 14:42:43
  • 2051

Spring官方文档翻译(1~6章)

Spring官方文档翻译
  • tangtong1
  • tangtong1
  • 2016-05-05 22:26:39
  • 29576

pl/sql编程(二)

第一点要理解以下四点: DDL:数据库模式定义语言,关键字:create DML:数据操纵语言,关键字:Insert、delete、update DCL:数据库控制语言 ,关键字:grant、rem...
  • luman1991
  • luman1991
  • 2016-08-24 21:57:24
  • 7146

MingW+Eclipse+GLUT做OpenGL

1.首先Mingw安装得比较全了 2.Eclipse的C语言版本也安装了 3.下载GLUT的二进制版本,具体哪个版本,以及从哪里下载,看这里 http://www.mingw.org/wiki/HOW...
  • cust_hf
  • cust_hf
  • 2013-12-13 19:53:10
  • 523

Invocation of init method failed; nested exception is javax.naming.CommunicationException [Root exce

[2013-08-29 11:10:42,664 main] SpringContextManager           ERROR Can't start spring with current ...
  • lixuekun820
  • lixuekun820
  • 2013-08-29 15:05:37
  • 5446

【Weblogic集群】Weblogic Cluster BEA-000116故障处理经验

原文来自:http://www.day-up.com/index.php?ac=article&at=read&did=305 部署环境:Weblogic 10 MP2 for UNIX 实验...
  • Frist_huangsuli
  • Frist_huangsuli
  • 2012-07-10 10:00:14
  • 6725

jboss单独启动没问题,但是和MyEclipse整合以后,启动的时候报了很多异常和错误!

org.jboss.deployment.DeploymentInfo@2800e14a { url=file:/F:/jboss-4.2.3.GA/server/default/deploy/jbo...
  • gaoge19861207
  • gaoge19861207
  • 2009-10-21 22:43:00
  • 1207

关于ActiveMQ大数据量时的无能为力

专设一台24G内存的服务器跑一个ActiveMQ节点,结果队列不到2千万时开始出现慢+卡的现象。不久它就挂了!     再访问控制页面的时候已经抛500内部错误了,截图如下:          ...
  • joeyon
  • joeyon
  • 2014-09-08 00:35:15
  • 5295

实例变量的初始化时机

类体内定义的变量被称为成员变量.如果定义该成员变量时没有使用static修饰,该成员变量又被成为非静态变量或实例变量;如果使用了static修饰,则该成员变量又可被成为静态变量或类变量. 对于实例...
  • licheng989
  • licheng989
  • 2016-12-13 15:03:26
  • 252
收藏助手
不良信息举报
您举报文章:(linux)activemq启动成功,但是jms调用失败问题
举报原因:
原因补充:

(最多只允许输入30个字)