tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject InitialContext in tomcat
Date Sun, 24 Apr 2011 19:10:11 GMT
Is there a way to avoid doing:

    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
    InitialContext initContext = new InitialContext(env);

Everytime I need a context. I am trying to avoid putting the
InitialContext Factory in my code. If I don't se the
INITIAL_CONTEXT_FACTORY the value for this property is :

java.naming.factory.initial: org.apache.naming.java.javaURLContextFactory

Which is the default tomcat JNDI. Is there a way to make this property
the default for the application, so I don't have to set it every time ?
I am trying to perform the lookup from jsp. I thought about using a
service locator. Is there a better way ? 

Thank you.




Mime
View raw message