【问题标题】:Connection to JMS broker failing与 JMS 代理的连接失败
【发布时间】:2017-11-07 06:41:54
【问题描述】:

我有一个 Glassfish 服务器 (4.1.2) 并遵循 this tutorial 我已将 Apache ActiveMQ 集成到服务器。之后,我根据this part of the same tutorial 开发了一个用于消息传递的独立客户端。完成后我按照last part of this tutorial 开发了一个MessageDrivenBean,用于监听前面步骤中使用的队列。

一切编译正常。 ActiveMQ 也在运行。但是每当我部署 EJB 时,我的 GF 服务器日志中都会记录以下内容:

Info:   visiting unvisited references
Info:   visiting unvisited references
Info:   JTS5014: Recoverable JTS instance, serverId = [3700]
Warning:   RAR8000 : The method setDestinationLookup is not present in the class : org.apache.activemq.ra.ActiveMQActivationSpec
Warning:   RAR7097: No setter method present for the property destinationLookup in the class org.apache.activemq.ra.ActiveMQActivationSpec
Info:   2017-06-06 11:43:00,675 [min-listener(1)] INFO  ActiveMQEndpointWorker         - Starting
Info:   2017-06-06 11:43:00,682 [ad-pool-1; w: 4] INFO  ActiveMQEndpointWorker         - Establishing connection to broker [vm://0.0.0.0:6616]
Info:   WELD-000900: 2.2.13 (Final)
WARN:   WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
WARN:   WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Info:   AmdMDB was successfully deployed in 5.290 milliseconds.
Info:   2017-06-06 11:43:31,695 [ad-pool-1; w: 4] ERROR ActiveMQEndpointWorker         - Failed to connect to broker [vm://0.0.0.0:6616]: Could not create Transport. Reason: java.net.URISyntaxException: Illegal character in scheme name at index 0: 0.0.0.0:6616
javax.jms.JMSException: Could not create Transport. Reason: java.net.URISyntaxException: Illegal character in scheme name at index 0: 0.0.0.0:6616
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
    at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:260)
    at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:273)
    at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:194)
    at org.apache.activemq.ra.ActiveMQResourceAdapter.makeConnection(ActiveMQResourceAdapter.java:132)
    at org.apache.activemq.ra.ActiveMQEndpointWorker$1.run(ActiveMQEndpointWorker.java:109)
    at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:107)
    at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
    at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 0: 0.0.0.0:6616
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.checkChar(URI.java:3031)
    at java.net.URI$Parser.parse(URI.java:3047)
    at java.net.URI.<init>(URI.java:588)
    at org.apache.activemq.util.URISupport.parseComposite(URISupport.java:390)
    at org.apache.activemq.util.URISupport.parseComposite(URISupport.java:279)
    at org.apache.activemq.transport.vm.VMTransportFactory.doCompositeConnect(VMTransportFactory.java:63)
    at org.apache.activemq.transport.vm.VMTransportFactory.doConnect(VMTransportFactory.java:54)
    at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:64)
    at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:258)
    ... 7 more
Info:   2017-06-06 11:43:31,697 [ad-pool-1; w: 4] ERROR ActiveMQEndpointWorker         - Endpoint will try to reconnect to the JMS broker in 30 seconds
Info:   2017-06-06 11:43:40,060 [jb-thread-pool1] INFO  ActiveMQEndpointWorker         - Stopping

最后的停止是由于我所做的取消部署,因为尝试重新连接时每隔三十秒就会出现同样的错误。

我不太确定,错误在哪里。顺便说一下,端口是 6616 不是拼写错误,它是 ActiveMQ 运行的实际端口,因为端口 61616 正在被另一个进程使用。

请给我一个提示,在哪里搜索错误?

顺便说一句:当我使用独立客户端向队列发送消息时,不会引发异常(因此这似乎有效。)但是,我也无法通过 ActiveMQ 管理控制台向服务器。

非常感谢...

【问题讨论】:

    标签: jakarta-ee glassfish jms activemq


    【解决方案1】:

    根据http://activemq.apache.org/vm-transport-reference.html,使用activemq vm tranport时,应该是“vm://”后面的broker名。

    如果要使用ip和端口,这样配置:

    vm:(broker:(tcp://localhost:6000)?persistent=false)?marshal=false
    

    【讨论】:

    • 好的,谢谢您的帮助。现在日志显示Successfully established connection to broker[vm:broker:(tcp://0.0.0.0))]。而且我正在接收消息。你是救命稻草:)
    • 有什么原因我必须等待大约 1 分钟才能从 activemq 管理控制台收到服务器日志中的消息?
    • @FabianSchneider 这似乎不正常。但我现在不知道为什么延迟 1 分钟。也许是一些非常详细的原因。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-20
    • 2017-11-08
    • 1970-01-01
    • 2014-04-04
    • 2013-04-27
    • 2021-10-05
    • 2020-09-27
    相关资源
    最近更新 更多