In my jndi.properties file I have written as follows
My client program is as follows
1. Properties prop=new Properties(new FileInputStream("jndi.properties"));
2. InitialContext context=new InitialContext(prop);
3. Object obj=context.lookup("MyEjb");
Line 1 and 2 has no problem, but in line 3 when I look up my ejb in server it returns null. I am not using any firewall and my necessary ports are open.
When I run my java client program in linux machine where my JBoss server is located then no problem occurs.
Try this. Enter the following at a command prompt on Windows:
telnet 192.168.1.104 1099
The last line of the response shpould have an IP address in it. On my PC it looks like:
If the IP address does not match that of your Linux box, add the following line to your /etc/hosts file:
192.168.1.104 <simple-pc-name> <pc-name-with-full-domain>
192.168.1.104 linuxbox1 linuxbox1.cox.net
I have the same issue, and in log file i am getting some thing like this.
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: R2SP11:11099 [Root exception is javax.naming.CommunicationException: Failed to connect to server R2SP11/192.168.1.46:11099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server R2SP11/192.168.1.46:11099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
I am getting something like this R2SP11/192.168.1.46