• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me JBOSS Initialcontext jndi lookup

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi

I am trying to call a EJB3 session Been from AWT as client

But i am getting "Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out"

Tried with different options with no use

Please guide me , this is inside my client code
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the app server running on localhost and does it have port 1099 open for JNDI?

Also see if this discussion helps: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=93668
 
Hakan Erdogan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- Make sure your jboss runs on localhost and your rmi port is 1099 (default values)
- Make sure you add jboss client jars in your classpath, if you have standalone application, if it runs on a jboss server no need to add extra jars into your classpath.

If you use -b parameter while starting server (e.g. run.sh -b 192.168.12.16) then use env.setProperty(Context.PROVIDER_URL, "192.168.12.16:1099");

Here is the example:

Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming");
env.setProperty(Context.PROVIDER_URL, "localhost:1099");

try {
   InitialContext context = new InitialContext(env);
   HelloWorldRemote helloWorldRemote = (HelloWorldRemote) context.lookup("HelloWorld/remote");
   helloWorldRemote.sayHello("Guest");
} catch (NamingException e) {
   e.printStackTrace();
}
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic