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

[6411 byte] By [jagadeesh_psa] at [2007-11-26 17:46:38]
# 1

Hi

I have the same problem, but I'm working with a Rich Client application and I have not an static IP, I'm using dyndns, It works very well for my http server and ftp server, but not for Boss EJB3?container,

any ideas?

do you know which ports have to be opened? there is only the 1099 port.

thanks

this is the stack trace

avax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.1.8; nested exception is:

java.net.ConnectException: Connection timed out: connect]

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)

at javax.naming.InitialContext.lookup(Unknown Source)

at ConexionGUI.clienteTest.getEnviaMensaje(clienteTest.java:41)

at ConexionGUI.frmPrincipal$1.widgetSelected(frmPrincipal.java:56)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3125)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2758)

at ConexionGUI.frmPrincipal.main(frmPrincipal.java:34)

Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.1.8; nested exception is:

java.net.ConnectException: Connection timed out: connect

at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)

at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)

at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)

... 10 more

Caused by: java.net.ConnectException: Connection timed out: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(Unknown Source)

at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)

at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)

... 16 more

Exception in thread "main" java.lang.NullPointerException

at ConexionGUI.frmPrincipal$1.widgetSelected(frmPrincipal.java:62)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3125)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2758)

at ConexionGUI.frmPrincipal.main(frmPrincipal.java:34)

Joleva at 2007-7-9 4:58:52 > top of Java-index,Core,Core APIs...
# 2
I have the exect same issue and was hoping that someone at Sun may be able to shed light on it.Have you had any luck getting it to work? If so, how did you do it?Here's hoping.Geoff
Geoff-Drneca at 2007-7-9 4:58:52 > top of Java-index,Core,Core APIs...