Search code examples
jbossrmijndi

Swing Client - EJB2 lookup over HTTP in JBoss 5.1


I have a swing client which connects to my ejb2 application deployed in JBoss 5.1. There is a particular requirement from Customer to make it available on internet.

The deployment architecture is as follows,

swing_client --> extranet_ip |firewall | --> iis7_machine --> jboss5.1_machine.

jndi properties in client is as follows Context.PROVIDER_URL=http://extranet_ip:9180/invoker/JNDIFactory Context.INITIAL_CONTEXT_FACTORY=org.jboss.naming.HttpNamingContextFactory

This configuration works fine when the client is inside intranet. But it does not work in internet (extranet).

When I tried initially I got the error 'Connection refused' After seeing some posts in various forums, I changed the file server\deploy\http-invoker.sar\META-INF\jboss-service.xml, to reflect the extranet_ip in invokerURL.

Aftet this I am getting the following error.

org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://10.200.1.193:4546/?dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]

Where 10.200.1.193 is the intranet IP address of JBoss Server machine.

I tried changing the trasport parameter in remoting-jboss-beans.xml to http, but at that time client is not working in both intranet and extranet.

Please anybody suggest a way forward for this issue. Or is there any other way to implement RMI over Http in JBoss?

Update: As a solution, I had to change my deployment architecture as follows.

swing_client --> extranet_ip |firewall | --> jboss5.1_machine

where the JBoss Application Server will be directly exposed through firewall. Then update clientConnectAddress in the remoting-jboss-beans.xml to the extranet IP. Also open the ports 8080 & 4446 in the firewall for this address.

This way the swing client is working if I use the jnid properties as follows.

Context.PROVIDER_URL : http://extranet_ip:8080/invoker/JNDIFactory
Context.INITIAL_CONTEXT_FACTORY : org.jboss.naming.HttpNamingContextFactory

But still looking for a solution where there is no need to open any non-standard ports and no need to expose the Application Server directly.


Solution

  • After a long struggle I found a solution for my issue. The solution was to change EJB container's invoker type to http in standardjboss.xml. When the invoker is http, it will use the settings in http-invoker.sar for remote binding.