Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JNDI Properties

Status
Not open for further replies.

Stedo

Programmer
Sep 15, 2005
44
SE
hi,

I'm running a JBoss application server where I deploy a session bean on the server. I try to connect locally (server running on localhost) using a stand-alone client and everything works fine.

Then I moved the server to a remote machine and deployed the same ear file. I changed the host in the jndi.properties file for the client and I receive the following exception:

Exception in thread "main" javax.naming.CommunicationException [Root exception i
s java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested excep
tion is:
java.net.ConnectException: Connection refused: 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 crimeportal.beans.laundry.Client.main(Client.java:41)
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nes
ted exception is:
java.net.ConnectException: Connection refused: 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)
... 3 more
Caused by: java.net.ConnectException: Connection refused: 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 S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
... 9 more



I am fairly new to J2EE and I'm probably missing something here, can anyone help?

Thanks in advance.
Steve
 
Somewhere you are telling JNDI to use a localhost (127.0.0.1) entry to connect to - or you are not specifying a remote host.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
hi,

Solved the problem. The problem was not on the client side, it was on the server side. The setting for the RMI host was set to localhost, so of course when JBoss send the RMI server address to the client it is set to localhost. Therefore the client was looking at localhost for the RMI server instead of the remote host. Ajusted the configuration for running JBoss and it worked like a dream.

Cheers
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top