HornetQ 使用 stomp-websocket 客户端报告 JBoss 7 中的 STOMP 帧无效?

发布于 2024-12-06 00:52:59 字数 3367 浏览 0 评论 0原文

以下测试客户端代码(使用 https://github.com/jmesnil/stomp-websocket)在 JBoss 7.0.1 中产生异常:

var client = Stomp.client("ws://192.168.0.4:61614/stomp");
client.connect("guest", "guest", function() {
    client.send("/queue/test", {priority: 9}, "Hello world!");
});

client.subscribe("/queue/test", function(message) {
    alert(message.body);
});

下面的一行也会发生这种情况:

new WebSocket("ws://192.168.0.4:61614/stomp");

为什么 JBoss HornetQ 报告以下异常?

08:56:55,732 ERROR [org.hornetq.core.protocol.stomp.StompProtocolManager] (Old I/O server worker (parentId: 17267825, [id: 0x01077c71, france/192.168.0.4:61614])) Failed to decode: org.hornetq.core.protocol.stomp.StompException: Invalid STOMP frame: G,E,T,32,/,s,t,o,m,p,32,H,T,T,P,/,1,.,1,13,10,U,p,g,r,a,d,e,:,32,w,e,b,s,o,c,k,e,t,13,10,C,o,n,n,e,c,t,i,o,n,:,32,U,p,g,r,a,d,e,13,10,H,o,s,t,:,32,1,9,2,.,1,6,8,.,0,.,4,:,6,1,6,1,4,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,O,r,i,g,i,n,:,32,n,u,l,l,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,K,e,y,:,32,J,9,d,h,k,4,a,w,c,Z,l,y,d,p,0,k,b,X,P,u,s,Q,=,=,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,V,e,r,s,i,o,n,:,32,8,13,10,13,10,
      at org.hornetq.core.protocol.stomp.StompDecoder.throwInvalid(StompDecoder.java:566) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompDecoder.decode(StompDecoder.java:367) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompProtocolManager.handleBuffer(StompProtocolManager.java:161) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompConnection.bufferReceived(StompConnection.java:269) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:458) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.7.Final.jar:]
      at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:362) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:357) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:90) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181) [netty-3.2.3.Final.jar:]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0]
      at java.lang.Thread.run(Thread.java:722) [:1.7.0]

The following test client code (using https://github.com/jmesnil/stomp-websocket) yields an exception in JBoss 7.0.1:

var client = Stomp.client("ws://192.168.0.4:61614/stomp");
client.connect("guest", "guest", function() {
    client.send("/queue/test", {priority: 9}, "Hello world!");
});

client.subscribe("/queue/test", function(message) {
    alert(message.body);
});

It also happens with the single line below:

new WebSocket("ws://192.168.0.4:61614/stomp");

Why does JBoss HornetQ report the following exception?

08:56:55,732 ERROR [org.hornetq.core.protocol.stomp.StompProtocolManager] (Old I/O server worker (parentId: 17267825, [id: 0x01077c71, france/192.168.0.4:61614])) Failed to decode: org.hornetq.core.protocol.stomp.StompException: Invalid STOMP frame: G,E,T,32,/,s,t,o,m,p,32,H,T,T,P,/,1,.,1,13,10,U,p,g,r,a,d,e,:,32,w,e,b,s,o,c,k,e,t,13,10,C,o,n,n,e,c,t,i,o,n,:,32,U,p,g,r,a,d,e,13,10,H,o,s,t,:,32,1,9,2,.,1,6,8,.,0,.,4,:,6,1,6,1,4,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,O,r,i,g,i,n,:,32,n,u,l,l,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,K,e,y,:,32,J,9,d,h,k,4,a,w,c,Z,l,y,d,p,0,k,b,X,P,u,s,Q,=,=,13,10,S,e,c,-,W,e,b,S,o,c,k,e,t,-,V,e,r,s,i,o,n,:,32,8,13,10,13,10,
      at org.hornetq.core.protocol.stomp.StompDecoder.throwInvalid(StompDecoder.java:566) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompDecoder.decode(StompDecoder.java:367) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompProtocolManager.handleBuffer(StompProtocolManager.java:161) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.protocol.stomp.StompConnection.bufferReceived(StompConnection.java:269) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:458) [hornetq-core-2.2.7.Final.jar:]
      at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.7.Final.jar:]
      at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:362) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:357) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:90) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) [netty-3.2.3.Final.jar:]
      at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181) [netty-3.2.3.Final.jar:]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0]
      at java.lang.Thread.run(Thread.java:722) [:1.7.0]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄居人 2024-12-13 00:52:59

查看standalone.xml(JBoss的主要配置文件),

旧的hornetq-configuration.xml位于消息子系统下。您所要做的就是在接受器下声明 stomp websocket:

  <acceptors>

            .....


      <acceptor name="stomp-websocket">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
         <param key="protocol" value="stomp_ws" />
         <param key="port" value="61614" />
      </acceptor>
   </acceptors>

Look at the standalone.xml (the main configuration file for JBoss)

the old hornetq-configuration.xml is under the message subsystem. All you have to do is to declare the stomp websocket under the acceptors:

  <acceptors>

            .....


      <acceptor name="stomp-websocket">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
         <param key="protocol" value="stomp_ws" />
         <param key="port" value="61614" />
      </acceptor>
   </acceptors>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文