• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

SocketTimeoutException when doing JNDI lookup

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to do JNDI lookup for remote stateless session bean. CommunicationException & SocketTimeoutException is thrown.

Isolation: When I have EJB server(JBoss) and client both in the same machine, and I try to connect using "java.naming.provider.url" = "localhost:1099", it works fine.. But if I change "localhost" by ip-address, it doesn't work. So when client is remote, then also its not working.

Here is the complete stack trace I am getting.


javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.0.42:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server 192.168.0.42:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 192.168.0.42:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1727)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:680)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.ejbtest.server.businessdelegates.ServiceLocator.getRemoteService(ServiceLocator.java:74)
at com.ejbtest.server.businessdelegates.ServiceLocator.getRemoteService(ServiceLocator.java:78)
at com.ejbtest.server.businessdelegates.UserDelegate.<init>(UserDelegate.java:28)
at com.ejbtest.server.businessdelegates.UserDelegate.createInstance(UserDelegate.java:37)
at com.ejbtest.server.UserServiceImpl.main(UserServiceImpl.java:16)
Caused by: javax.naming.CommunicationException: Failed to connect to server 192.168.0.42:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 192.168.0.42:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:311)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1698)
... 8 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server 192.168.0.42:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:281)
... 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 org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)Completed lookup of UserBean

at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:277)
... 9 more
java.lang.NullPointerException
at com.ejbtest.server.businessdelegates.UserDelegate.insert(UserDelegate.java:43)
at com.ejbtest.server.UserServiceImpl.main(UserServiceImpl.java:21)


Thanks in advance.

 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I got solution to this problem. Just launched JBoss with -b 0.0.0.0 as argument. This link helped me.

http://www.theserverside.com/discussions/thread.tss?thread_id=49698
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic