[jboss-user] [JNDI/Naming/Network] - Re: Data Source JNDI lookup fails in a WAR

jaikiran do-not-reply at jboss.com
Fri Jul 11 12:16:18 EDT 2008

anonymous wrote : org.springframework.jndi.JndiTemplate context = new org.springframework.jndi.JndiTemplate();
  | context.lookup("java:TestDB");

Sorry, i dont have any experience with Spring. So i wont be able to provide much help on that part.

anonymous wrote : I already tried the InitialContext but it didn't work, I got a null.

That's real strange. I wouldn't expect a NULL to be returned from the lookup.

anonymous wrote : It have to be something with the differences between the EAR and WAR deploying but I didn't figure out what.

Looking up from a WAR or an EAR should not make a difference. Unless there are configuration files in your WAR application which might be messing up the lookup. 

At this point, i am actually running out of ideas. How about trying this:

Properties props= new Properties();
  | props.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
  | props.put(InitialContext.PROVIDER_URL, "jnp://");
  | Context ctx = new InitialContext(props);
  | ctx.lookup("java:/TestDB");

I remember a similar issue in these forums, where a user was having problems getting the datasource lookup to work with Spring. Let me see if i can find that thread.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163914#4163914

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163914

More information about the jboss-user mailing list