HornetQ in Ubuntu Server 12.04 through VirtualBox
fran_jo Apr 24, 2013 6:49 AMHello everyone!
I am working in Windows XP and I have recently set up a Ubuntu Server 12.04 as a guest, using Virtual Box. I want to set up HornetQ (version 2.2.14) to be accessed from the host (WinXP).
I want to run the HornetQ server as a stand-alone server, so I add the following configuration to the hornetq-configuration.xml:
<connectors> ... <connector name="remote-netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:10.0.2.15}"/> <param key="port" value="${hornetq.remoting.netty.port:5005}"/> </connector> </connectors> <acceptors> ... <acceptor name="remote-netty"> <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:10.0.2.15}"/> <param key="port" value="${hornetq.remoting.netty.port:5005}"/> </acceptor> </acceptors>
(see that the 10.0.2.15 is the IP address of the eth0 from Ubuntu Server)
and to the hornetq-jms.xml:
<connection-factory name="NettyConnectionFactory"> <xa>false</xa> <connectors> <connector-ref connector-name="remote-netty"/> </connectors> <entries> <entry name="/RTConnectionFactory"/> </entries> </connection-factory>
I also create a VirtualBox port, using a NAT adapter that points to this configuration, something like this:
Port Name | Protocol | Host IP | Port | Guest IP | Port |
---|---|---|---|---|---|
hornetq | tcp | myIP | 5005 | 10.0.2.15 | 5005 |
With this configuration, I try to execute the Queue example but
// Step 1. Create an initial context to perform the JNDI lookup. Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.PROVIDER_URL, "jnp://myIP:5005"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces "); initialContext = new InitialContext(env); // Step 2. Perfom a lookup on the queue Queue queue = (Queue)initialContext.lookup("/queue/OrderQueue"); // Step 3. Perform a lookup on the Connection Factory ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/RTConnectionFactory");
But I get communication error like this:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: myIP:5005
Does any one experience this problem? Or do you have any idea about what could be wrong?
Greetings!