I'm testing a very simple scenario, I'm running the test located under examples/jms/queue on a standalone server running locally on my computer with success. Running the same on a dockerized HornetQ 2.4.0 gives me the error:
Connection refused: connect
I made sure to open port 1099 and I can see the port open,
0.0.0.0:1099->1099/tcp
Telnet-ing to localhost 1099 gives a gibberish result with means there is something there listening but running the test connecting to jnp://localhost:1099 as I said it's failing.
Finally the configuration of hornetq-beans.xml:
<bean name="StandaloneServer" class="org.hornetq.jms.server.impl.StandaloneNamingServer">
<constructor>
<parameter>
<inject bean="HornetQServer"/>
</parameter>
</constructor>
<property name="port">1099</property>
<property name="bindAddress">0.0.0.0</property>
<property name="rmiPort">1098</property>
<property name="rmiBindAddress">0.0.0.0</property>
</bean>
Result of netstat -plunt:
# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5445 0.0.0.0:* LISTEN 10/java
tcp 0 0 0.0.0.0:1098 0.0.0.0:* LISTEN 10/java
tcp 0 0 0.0.0.0:1099 0.0.0.0:* LISTEN 10/java
tcp 0 0 0.0.0.0:39437 0.0.0.0:* LISTEN 10/java
tcp 0 0 0.0.0.0:5455 0.0.0.0:* LISTEN 10/java
My Dockerfile:
FROM openjdk:8
WORKDIR /app
COPY ./hornetq-2.4.0.Final .
EXPOSE 1099 1098 5445 5455
ENTRYPOINT [ "/bin/bash", "-c", "cd bin/; ./run.sh" ]
The updated part of hornetq-configuration.xml:
<connectors>
<connector name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="0.0.0.0"/>
<param key="port" value="5445"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="0.0.0.0"/>
<param key="port" value="5455"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="0.0.0.0"/>
<param key="port" value="5445"/>
</acceptor>
<acceptor name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="0.0.0.0"/>
<param key="port" value="5455"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
The updated part of hornetq-beans.xml:
<bean name="StandaloneServer" class="org.hornetq.jms.server.impl.StandaloneNamingServer">
<constructor>
<parameter>
<inject bean="HornetQServer"/>
</parameter>
</constructor>
<property name="port">1099</property>
<property name="bindAddress">0.0.0.0</property>
<property name="rmiPort">1098</property>
<property name="rmiBindAddress">0.0.0.0</property>
</bean>
The command I'm using to run the image is:
docker run -d -p 1098:1098 -p 1099:1099 -p 5445:5445 -p 5455:5455 hornetq