Stomp - SocketException: Connection reset
aevo Sep 8, 2010 4:09 AMHi all,
I'm using Perl and Stomp (cpan: Net-Stomp-0.38) to send messages to HornetQ (v. 2.1.2.Final). The perl code:
#!/usr/bin/perl -w
use Net::Stomp;
my $stomp = Net::Stomp->new( { hostname => '...', port => '61613' } );
$stomp->connect( { login => 'guest', passcode => 'guest' } );
$stomp->send(
{ destination => '/queue/RbQueue',
type => 'xml-msg',
body => '<request>...</request>' } );
$stomp->disconnect;
Generally, it's working and the message is send to the queue correctly. But on the HornetQ server I'm getting an exception when I'm executing the script:
[StompConnect Transport: tcp:///...:52840] 09:29:18,019 SEVERE [org.codehaus.stomp.jms.ProtocolConverter] Caught: java.net.SocketException: Connection reset java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at org.codehaus.stomp.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50) at org.codehaus.stomp.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58) at java.io.DataInputStream.readByte(DataInputStream.java:248) at org.codehaus.stomp.StompMarshaller.readLine(StompMarshaller.java:189) at org.codehaus.stomp.StompMarshaller.unmarshal(StompMarshaller.java:94) at org.codehaus.stomp.tcp.TcpTransport.run(TcpTransport.java:130) at java.lang.Thread.run(Thread.java:619)
What I'm doing wrong? Any ideas?
HornetQ configuration:
hornetq-configuration.xml:
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:...}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</acceptor>
<!-- SVE: Added for Stomp -->
<acceptor name="invm">
<factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
</acceptor>
...
<address-settings>
<!-- Main queue catch -->
<address-setting match="jms.queue.RbQueue">
<dead-letter-address>jms.queue.RbDeadLetterQueue</dead-letter-address>
<redelivery-delay>3000</redelivery-delay>
<redistribution-delay>500</redistribution-delay>
<max-delivery-attempts>3</max-delivery-attempts>
<max-size-bytes>-1</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<message-counter-history-day-limit>2</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
...
hornetq-beans.xml:
... <!-- The JMS in-VM connection factory for StompConnect use --> <bean name="StompConnectionFactory" class="javax.jms.ConnectionFactory"> <constructor factoryClass="org.hornetq.api.jms.HornetQJMSClient" factoryMethod="createConnectionFactory"> <parameter class="org.hornetq.api.core.TransportConfiguration"> <bean class="org.hornetq.api.core.TransportConfiguration"> <constructor> <parameter>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</parameter> </constructor> </bean> </parameter> </constructor> </bean> <!-- The StompConnect instance --> <bean name="StompConnect" class="org.codehaus.stomp.jms.StompConnect"> <constructor> <parameter> <inject bean="StompConnectionFactory"/> </parameter> </constructor> <install method="start"/> </bean> ...