unable to createTopicConnection using jms client with jboss
tmccormick Oct 28, 2004 1:06 PMI've been trying to get my client app to receive JMS messages from a Topic connection with JBoss sitting behind a fierewall.
I've scanned the JBoss forums and the internet looking for help in configuring the router and the JBoss server. And I still can't
get things to work. I had a regular Linksys 802.11b router and upgraded to a Linksys 802.11g router about a month ago when I got a
new Sony VAIO. I've tried Port Forwarding, DMZ, Windows VPN Server, Linksys VPN Tunnel and can't get anything to work. I have
an application running under JBoss and wanted to acess it via my portable while I was at work. Is this supposed to be this hard?
I can perform remote management on the router without any problems. I can run any web application, both HTTP and HTTPS on the server
behind the firewall without any problems. I can run the JMX console remotely without any problems. I can run my client app, and receive JMS
messages when running inside the firewall, but when I run the app remotely it hangs when trying to createTopicConnection(). I've tried connecting
using ConnectionFactory, UIL2ConnectionFactory and HTTPConnectionFactory using JNP and HTTP settings with the same effect:
I use a ConnectionParams class to read a properties file to set the jndi properties. The file that it reads also lets me configure the jboss connection factory.
Below you will find connection params, sample code, and environment info. Can anyone see what I'm doing wrong? I thought I could receive JMS messages
using JNDI and HTTP from behind a firewall with a lot less headache. Does anybody out there have this working?
Any help would be appreciated.
Thanks,
Tom
[ConnectionParams]
#------------------------------------------------------------------------------ JBoss, JNDI, localhost #java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces #java.naming.provider.url=jnp://localhost:1099 #------------------------------------------------------------------------------ JBoss, JNDI, static ip (inside firewall) #java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces #java.naming.provider.url=jnp://10.45.115.100:1099 #------------------------------------------------------------------------------ JBoss, JNDI, public ip (outside firewall) java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://151.196.34.155:1099 #------------------------------------------------------------------------------ JBoss, HTTP, public ip (outside firewall) #java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces #java.naming.provider.url=http://151.196.34.155:8442/invoker/JNDIFactory #------------------------------------------------------------------------------ Security #java.naming.security.authentication=none #java.naming.security.principal= #java.naming.security.credentials= #------------------------------------------------------------------------------ Security java.naming.security.authentication=simple java.naming.security.principal=heartbeats java.naming.security.credentials=heartbeats #------------------------------------------------------------------------------ Jboss Connection Factory #jboss.connection.factory=ConnectionFactory jboss.connection.factory=UIL2ConnectionFactory #jboss.connection.factory=HTTPConnectionFactory
[Sample Code]
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, ConnectionParams.INITIAL_CONTEXT_FACTORY); env.put(Context.URL_PKG_PREFIXES, ConnectionParams.URL_PKG_PREFIXES); env.put(Context.PROVIDER_URL, ConnectionParams.PROVIDER_URL); InitialContext ctx_ = new InitialContext(env); System.out.println("tcf::lookup ConnectionFactory..."); TopicConnectionFactory tcf_ = (TopicConnectionFactory) ctx_.lookup(ConnectionParams.JBOSS_CONNECTION_FACTORY); System.out.println("tcf::createTopicConnection..."); TopicConnection conn_ = tcf_.createTopicConnection (); //<================== ALWAYS HANGS HERE!!!! System.out.println("tcf::createTopicSession..."); topicSession = conn_.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); System.out.println("tcf::createTopic..."); topic = topicSession.createTopic(topicName); System.out.println("Successful!");
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here's my environment:
[Router]
- Linksys WRV54G
- Using Port Forwarding instead of DMZ
- My ISP is Verizon and they're blocking port 80. Linksys uses port 8080 for remote management, and port 443 when using their Linksys Quick VPN software.
So I'm using 8442 for HTTP, 8443 for HTTPS and 8444 for the AJP protocol. Here's the complete list of open ports and their usage:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21 TCP FTP 1099 TCP conf/jboss-service.xml jboss:service=Naming Port 1098 TCP conf/jboss-service.xml jboss:service=Naming RmiPort 1100 TCP JMS XA 4444 TCP conf/jboss-service.xml jboss:service=invoker,type=jrmp RMIObjectPort? 4445 TCP conf/jboss-service.xml jboss:service=invoker,type=pooled ServerBindPort? 8083 TCP conf/jboss-service.xml jboss:service=WebService Port 8090 TCP deploy/jms/oil-service.xml jboss.mq:service=InvocationLayer?,type=OIL ServerBindPort? 8092 TCP deploy/jms/oil2-service.xml jboss.mq:service=InvocationLayer?,type=OIL2 ServerBindPort? 8093 TCP deploy/jms/uil2-service.xml jboss.mq:service=InvocationLayer?,type=UIL2 ServerBindPort? 8080-->8442 TCP deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml jboss.web:service=WebServer? port on HTTP Connector 443-->8443 TCP deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml jboss.web:service=WebServer? port on HTTPS Connector 8009-->8444 TCP deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml jboss.web:service=WebServer? port on AJP Connector
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[Server]
- Using Windows XP SP2, Firewall disabled
- Using JBoss 4.0
- Configured JBoss to use public IP address, intead of local IP address by adding defines in the run.bat startp file. The following was added:
-Djava.rmi.server.hostname=<151.196.34.155> -Djava.rmi.server.useLocalHostname=false
- Configured deploy\conf\jboss-service.xml with the following changes:
<!-- ==================================================================== --> <!-- JNDI --> <!-- ==================================================================== --> <mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming"> <attribute name="Port">1099</attribute> <attribute name="RmiPort">1098</attribute> </mbean> <!-- ==================================================================== --> <!-- Invokers to the JMX node --> <!-- ==================================================================== --> <!-- RMI/JRMP invoker --> <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker" name="jboss:service=invoker,type=jrmp"> <attribute name="RMIObjectPort">4444</attribute> <!-- <attribute name="ServerAddress">${jboss.bind.address}</attribute> <attribute name="RMIClientSocketFactory">custom</attribute> <attribute name="RMIServerSocketFactory">custom</attribute> <attribute name="RMIServerSocketAddr">custom</attribute> <attribute name="SecurityDomain">ssl-domain-name</attribute> --> <depends>jboss:service=TransactionManager</depends> </mbean> - Configured deploy\jbossweb-tomcat50.sar\server.xml with appropriate port settings - Configured deploy\jms with queue and topic definitions - I installed the http-invoker.sar into the default\deploy directory and configured it as follows: [deploy\http-invoker.sar\META-INF\jboss-service.xml] <server> <!-- The HTTP invoker service configration --> <mbean code="org.jboss.invocation.http.server.HttpInvoker" name="jboss:service=invoker,type=http"> <!-- Use a URL of the form http://<hostname>:8442/invoker/EJBInvokerServlet where <hostname> is InetAddress.getHostname value on which the server is running. --> <!-- <attribute name="InvokerURLPrefix">http://</attribute> <attribute name="InvokerURLSuffix">:8442/invoker/EJBInvokerServlet</attribute> <attribute name="UseHostName">true</attribute> --> <attribute name="InvokerURL">http://<151.196.34.155>:8442/invoker/EJBInvokerServlet</attribute> </mbean> <mbean code="org.jboss.mq.il.http.HTTPServerILService" name="jboss.mq:service=InvocationLayer,type=HTTP"> <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends> <depends>jboss.web:service=WebServer</depends> <attribute name="ConnectionFactoryJNDIRef">HTTPConnectionFactory</attribute> <attribute name="XAConnectionFactoryJNDIRef">HTTPXAConnectionFactory</attribute> <attribute name="PingPeriod">0</attribute> <attribute name="TimeOut">60</attribute> <attribute name="RestInterval">0</attribute> </mbean> <mbean code="org.jboss.invocation.http.server.HttpInvokerHA" name="jboss:service=invoker,type=httpHA"> <!-- Use a URL of the form http://<hostname>:8442/invoker/EJBInvokerHAServlet where <hostname> is InetAddress.getHostname value on which the server is running. --> <!-- <attribute name="InvokerURLPrefix">http://</attribute> <attribute name="InvokerURLSuffix">:8442/invoker/EJBInvokerHAServlet</attribute> <attribute name="UseHostName">true</attribute> --> <attribute name="InvokerURL">http://<151.196.34.155>:8442/invoker/EJBInvokerHAServlet</attribute> </mbean> <!-- Expose the Naming service interface via HTTP --> <mbean code="org.jboss.invocation.http.server.HttpProxyFactory" name="jboss:service=invoker,type=http,target=Naming"> <!-- The Naming service we are proxying --> <attribute name="InvokerName">jboss:service=Naming</attribute> <!-- Compose the invoker URL from the cluster node address --> <!-- <attribute name="InvokerURLPrefix">http://</attribute> <attribute name="InvokerURLSuffix">:8442/invoker/JMXInvokerServlet</attribute> <attribute name="UseHostName">true</attribute> --> <attribute name="InvokerURL">http://<151.196.34.155>:8442/invoker/JMXInvokerServlet</attribute> <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute> <attribute name="JndiName"></attribute> <attribute name="ClientInterceptors"> <interceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor> </interceptors> </attribute> </mbean> <!-- Expose the Naming service interface via clustered HTTP. This maps to the ReadOnlyJNDIFactory servlet URL --> <mbean code="org.jboss.invocation.http.server.HttpProxyFactory" name="jboss:service=invoker,type=http,target=Naming,readonly=true"> <attribute name="InvokerName">jboss:service=Naming</attribute> <!-- <attribute name="InvokerURLPrefix">http://</attribute> <attribute name="InvokerURLSuffix">:8442/invoker/readonly/JMXInvokerServlet</attribute> <attribute name="UseHostName">true</attribute> --> <attribute name="InvokerURL">http://<151.196.34.155>:8442/invoker/readonly/JMXInvokerServlet</attribute> <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute> <attribute name="JndiName"></attribute> <attribute name="ClientInterceptors"> <interceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor> </interceptors> </attribute> </mbean> </server>