HornetQ 上的 WebSocket 上的 STOMP:实例化远程接受器时出错

STOMP over WebSocket on HornetQ: Error instantiating remoting acceptor

我设置了一个 spring Web 应用程序,它将通过 WebSocket 上的 STOMP 连接到一个独立的 HornetQ 实例,如下所示:http://jmesnil.net/stomp-websocket/doc/。我必须为此项目使用独立实例,出于设计原因,我无法在我的 spring 应用程序中嵌入 jms 代理。

我遇到的问题是使用支持 STOMP_WS 协议的 netty 接受器启动 HornetQ 服务器。我在 hornetq-configuration.xml 中为接受器添加了一个条目,如下所示:

  <acceptor name="stomp-ws-acceptor">
  <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
  <param key="protocols" value="STOMP_WS"/>
  <param key="port" value="61614"/>
  </acceptor>

但是当我启动 HornetQ 服务器时出现错误:

00:36:09,061 WARN  [org.hornetq.core.server] HQ222080: Error instantiating remoting acceptor org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory: HornetQException[errorType=GENERIC_EXCEPTION message=HQ119085: Classpath lacks a protocol-manager for protocol STOMP_WS]
    at org.hornetq.core.remoting.server.impl.RemotingServiceImpl.start(RemotingServiceImpl.java:279) [hornetq-server.jar:]
    at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1689) [hornetq-server.jar:]
    at org.hornetq.core.server.impl.HornetQServerImpl.access00(HornetQServerImpl.java:172) [hornetq-server.jar:]
    at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2169) [hornetq-server.jar:]
    at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:432) [hornetq-server.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:483) [hornetq-jms-server.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_91]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_91]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_91]
    at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.8.0_91]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59) [jboss-mc.jar:]
    at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150) [jboss-mc.jar:]
    at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774) [jboss-mc.jar:]
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130) [jboss-mc.jar:]
    at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96) [jboss-mc.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:236) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:206) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:154) [hornetq-bootstrap.jar:]
    at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83) [jboss-mc.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:115) [hornetq-bootstrap.jar:]
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:69) [hornetq-bootstrap.jar:]

是否缺少依赖项或者我的语法不正确?我还在启动日志中看到:

00:36:08,460 INFO  [org.hornetq.core.server] HQ221043: Adding protocol support CORE
00:36:08,460 INFO  [org.hornetq.core.server] HQ221043: Adding protocol support AMQP
00:36:08,460 INFO  [org.hornetq.core.server] HQ221043: Adding protocol support STOMP

但是 STOMP_WS 不在这个协议列表中,正如我在文档的其他地方看到的那样。任何帮助,将不胜感激。

你可以参考这里的讨论,https://developer.jboss.org/thread/233656

此外,不确定您使用的 Wilfly/EAP 是哪个版本,但请确保 netty-all-4.0.13.Final.jar 可用并加载了以下配置:

         <netty-acceptor name="netty-acceptor" socket-binding="netty">
                <param key="protocols" value="STOMP"/>
            </netty-acceptor>