Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jndi.properties rage  RSS feed

 
Andy Evans
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Argh... let the screaming begin....
During the prototyping stage of our code we happily hardcoded the jndi lookup information... however, now it makes sense to try and move it all out to a jndi.properties file. I cannot get it to work.
We're using tomcat 4.0.3 & jboss 3.0.0....
This was the original code that worked:
String urlName = "10.225.68.103:1099";
java.util.Properties p = new java.util.Properties();
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.provider.url", urlName);
javax.naming.InitialContext jndiContext = new javax.naming.InitialContext(p);
Object ref = jndiContext.lookup("eppix/Integration");
Based on that - and from examples I found on the web, I created a jndi.properties file containing the following three entries... (the last one was added experimentally, I have no idea if it's useful.. it certainly didn't change anything)
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=10.225.68.103:1099
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
The code was changed to:
javax.naming.InitialContext jndiContext = new javax.naming.InitialContext();
Object ref = jndiContext.lookup("eppix/Integration");
If I break the code, at runtime, on the lookup line, the initialcontext has picked up the entries in the jndi.properties... however the contents of the context are COMPLETELY different when done the original way and when done the new way.
Using the properties file I just keep getting a "Name eppix is not bound in this Context" error message... (a javax.naming.NameNotFoundException)....
Has anyone got a clue what is going on here?
I've searched for ages and not come up with anything even close to an answer.
Cheers in advance.
(e)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!