JNDI lookup problem
Hi All,
I am working on a Java webstart application with JMS. The application scenario is a little bit differnt than a normal application. My JBoss is running on a Local machine(IP: 192.168.1.2) inside the Lan, and the java webstart clients outside the network has to communicate with this server through the gateway server(IP: 203.200.112.125) of the network. This gateway server will forward all requests to the JBoss which runs on the local machine. From the local network this application works well, but when I try to access the application using http://203.200.112.125/appname from an external network, I am able to download the webstart and start the program, but when I try to access the deployed bean for login or any kind of business activity , it gives me a lot of Exceptions. The stack trace is as follows...
javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.1.2; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:606)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:568)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.klc.locator.ServiceLocator.getHome(ServiceLocator.java:56)
at com.klc.klwebspy.ServerManager.(ServerManager.java:26)
at com.klc.klwebspy.ServerManager.getInstance(ServerManager.java:39)
at com.klc.klnetcenter.database.postgres.KLNetCenterDB.create(KLNetCenterDB.java:310)
at com.klc.klnetcenter.database.postgres.KLNetCenterDB.checkDatabase(KLNetCenterDB.java:92)
at com.klc.klnetcenter.KLNetcenter.initialization(KLNetcenter.java:65)
at com.klc.klnetcenter.KLNetcenter.(KLNetcenter.java:23)
at com.klc.klnetcenter.KLNetcenter.main(KLNetcenter.java:35)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at java.net.Socket.(Socket.java:291)
at java.net.Socket.(Socket.java:119)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
... 15 more
java.lang.NullPointerException
at com.klc.klwebspy.ServerManager.executeRequest(ServerManager.java:46)
at com.klc.klnetcenter.database.postgres.KLNetCenterDB.create(KLNetCenterDB.java:310)
at com.klc.klnetcenter.database.postgres.KLNetCenterDB.checkDatabase(KLNetCenterDB.java:92)
at com.klc.klnetcenter.KLNetcenter.initialization(KLNetcenter.java:65)
at com.klc.klnetcenter.KLNetcenter.(KLNetcenter.java:23)
at com.klc.klnetcenter.KLNetcenter.main(KLNetcenter.java:35)
When I try to contact the application , I am getting exceeption from the following line
properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
// properties.put(Context.PROVIDER_URL, "203.200.142.140");
properties.put(Context.PROVIDER_URL,"jnp://"+KLNetcenterData.SERVER_IP+":1099");
InitialContext ctx = new InitialContext(properties);
log.info("Looking up Topic....");
queue = (Topic) ctx.lookup("topic/testDurableTopic");
which means , when I call contect.lookup I am getting the exception as follows.
javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.1.2; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:606)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:568)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.klc.klnetcenter.jms.SendClient.(SendClient.java:40)
at com.klc.klnetcenter.KLNetcenterData.(KLNetcenterData.java:42)
at com.klc.klnetcenter.KLNetcenterData.getInstance(KLNetcenterData.java:53)
at com.klc.klnetcenter.KLNetcenterFrame.(KLNetcenterFrame.java:101)
at com.klc.klnetcenter.KLNetcenterFrame.getInstance(KLNetcenterFrame.java:183)
at com.klc.klnetcenter.KLNetcenter.(KLNetcenter.java:24)
at com.klc.klnetcenter.KLNetcenter.main(KLNetcenter.java:35)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at java.net.Socket.(Socket.java:291)
at java.net.Socket.(Socket.java:119)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
... 14 more
Please Help
Thanks
Jagadeesh

