-
1. Re: Getting JNDI context fails
peterj Sep 7, 2006 10:52 AM (in response to schlaufuchs)It would help if you posted the exact error message. The IP address 127.0.0.1 is for localhost, I am not familiar with 127.0.0.2. In your client, what is java.naming.provider.url set to?
-
2. Re: Getting JNDI context fails
schlaufuchs Sep 7, 2006 2:00 PM (in response to schlaufuchs)Ok, here comes the stack trace:
07.09.2006 19:55:19 de.hackemesser.frieshouse.client.Manager getContext INFO: Creating jndi context javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.2; nested exception is: java.net.ConnectException: Connection refused: connect] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(Unknown Source) at de.hackemesser.frieshouse.client.Manager.getCore(Manager.java:41) at de.hackemesser.frieshouse.client.ManagerView.getStocklevel(ManagerView.java:420) at de.hackemesser.frieshouse.client.ManagerView.getStockLevelDisplay(ManagerView.java:154) at de.hackemesser.frieshouse.client.ManagerView.getMenu(ManagerView.java:144) at de.hackemesser.frieshouse.client.ManagerView.initialize(ManagerView.java:117) at de.hackemesser.frieshouse.client.ManagerView.<init>(ManagerView.java:106) at de.hackemesser.frieshouse.client.Manager.main(Manager.java:20) Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.2; nested 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:625) ... 9 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 Source) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ... 15 more
Here comes the jndi.properties (client side)# jndi.properties java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory # java.naming.provider.url=localhost java.naming.provider.url=jnp\://192.168.0.2\:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
this is how I create my context in Manager.class:if (ctx == null) { log.info("Creating jndi context"); ctx = new InitialContext(); }
and this is my first lookup which fails:core = (CoreServiceRemote) getContext().lookup( "CoreService/remote");
Any idea?
Thanks,
Kai -
3. Re: Getting JNDI context fails
peterj Sep 7, 2006 2:23 PM (in response to schlaufuchs)Is 192.168.0.2 the IP address of the host running JBoss? What is the IP address of the client machine? Also, which operatin system are you using?
I tried pinging 127.0.0.2 and 127.0.0.3 and in both cases ping converted the address to 127.0.0.1. Which leads me to assume that 192.168.0.2 is the IP address of your client machine. -
4. Re: Getting JNDI context fails
schlaufuchs Sep 7, 2006 2:30 PM (in response to schlaufuchs)Ok, but why and what is connecting to my machine at 127.0.0.2? When I shut down the server or change the IP address in properties I get connection timeout exception. This strange exception comes only if the connection is beeing established.
-
5. Re: Getting JNDI context fails
peterj Sep 8, 2006 11:35 AM (in response to schlaufuchs)Still waiting for the answer to my three questions...
-
6. Re: Getting JNDI context fails
schlaufuchs Sep 8, 2006 11:58 AM (in response to schlaufuchs)The IP address of the server is 192.168.0.2. OS is Suse Linux 10.0.
The IP adress of my test client is 192.168.0.9. OS is Win XP SP2 . -
7. Re: Getting JNDI context fails
peterj Sep 8, 2006 1:48 PM (in response to schlaufuchs)Run telnet as follows from your Windows PC:
telnet 192.168.0.2 1099
The last line of the response should contain the text UnicastRef2 followed by an IP address. Which IP address shows? Here is my last line when I telnet to my Fedora Core 5 system that is running JBoss:
UnicastRef2192.59.193.104
What are the contents of your /etc/hosts file on the server? Do you have a line that has the IP address of the server? In my /etc/hosts files I have the following line:
192.59.193.104 usmv-johnsop1l
If I recall correctly (it has been many months since I worked around a similar issue), without this line the telnet response has 127.0.01 as the IP address and this tends to confuse clients. -
8. Re: Getting JNDI context fails
schlaufuchs Sep 8, 2006 1:53 PM (in response to schlaufuchs)Hi,
I found that Suse somewhy adds a line to /etc/hosts setting the server ip as 127.0.0.2. I can't think what for this entry should be good, but after I replaced it with the real IP adress everything started workling :-)
Thank you for you help! -
9. Re: Getting JNDI context fails
peterj Sep 8, 2006 1:57 PM (in response to schlaufuchs)Now you know why I asked for the operating system, I recalled this issue with Linux but didn't want to point you to the /etc/hosts file if you were running Windows only. Glad you are up and running.
If I am ever in Stuttgard, you owe me a beer, you sly fox. ;-) -
10. Re: Getting JNDI context fails
schlaufuchs Sep 8, 2006 2:49 PM (in response to schlaufuchs)Of course :-) But hurry, I am planning to immigrate to New Zealand in the next year :-)
-
11. Re: Getting JNDI context fails
tratswin Oct 11, 2006 2:36 AM (in response to schlaufuchs)thanks, it solved my problem too!