I did a bit a troubleshooting. Here's the stack trace:
javax.naming.CommunicationException: Failed to connect to server localhost:1099. Root exception is
I took a look at NamingContext.java:199 and found that the ClassCast is occurring while trying to do a cast to Naming. Naming appears to be a representation of a client side JNDI server. Therefore, it does not appear to be my code, but it appears to be something with the configuration of my server?
I am using a standard configuration. I made no modifications to any files in the standard jboss 3.2.3 implementation. I am passing the following properties to the server during startup:
Suggestions would be appreciated ...
I am really stuck on this problem and any help would be appreciated. I have been adding to the following thread, and if anyone has any input, please add to it. I am really stuck and frustrated. I believe this to be a problem within JBoss and not in my code.
I read somewhere in the forums that maybe I should not supply a hostname and factory while trying to get the initial context. I tried that, and that did not solve the problem. Hence, I did this:
props = new Properties();
// JBOSS DOES NOT LIKE THE FOLLOWING TWO LINES... GO FIGURE.
// props.put(Context.PROVIDER_URL, jndiProviderUrl);
if (user != null)
if (password != null)
Context out=new InitialContext(props);