geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Aufdencamp" <>
Subject JNDI Context Lookup Help
Date Mon, 17 Nov 2008 19:57:57 GMT
Hi All,

It's been a while since I had to ask for help from the list, but I hit a
snag migrating an application from G-1.1.1 to G-2.1.3.  Specifically,
I'm having a problem with a JNDI context lookup inside a
ServletContextListener.  I presume this is a problem with the move to a
global JNDI namespace in G-1.2 and forward.  I have had the same result
in 1.2-beta and 2.1.3.  The Documentation and Google have not helped me

I'm looking up an <env-entry> defined in the web.xml:


Access code as follows:

String contentLocation = null;
String contentLocationJNDIName = "java:/comp/env/web/ContentLocation";

Context ctx = null;
boolean initialContextSuccess = false;
try {
  ctx = new InitialContext();
  initialContextSuccess = true;
} catch (NamingException namingException){

    contentLocation = (String) ctx.lookup(contentLocationJNDIName);
  } catch(NamingException namingException){
} else{
 // Error Handling

The ctx.lookup() throws a javax.naming.NotContextException:

Do I need to define Properties for the InitialContext Factory, add
something to my geronimo-web.xml plan, or utilize a different JNDI name?

Thanks for your help,

Mark Aufdencamp

View raw message