jQuery in Action, 3rd edition
The moose likes JBoss/WildFly and the fly likes Help me JBOSS Initialcontext jndi lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Help me JBOSS Initialcontext jndi lookup" Watch "Help me JBOSS Initialcontext jndi lookup" New topic

Help me JBOSS Initialcontext jndi lookup

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


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

Save India From Corruption - Anna Hazare.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

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

JBoss In Action
Hakan Erdogan

Joined: Jun 30, 2006
Posts: 10
- 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 then use env.setProperty(Context.PROVIDER_URL, "");

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");
} catch (NamingException e) {

SCJP 1.4
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

I agree. Here's the link: http://aspose.com/file-tools
subject: Help me JBOSS Initialcontext jndi lookup
It's not a secret anymore!