tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: InitialContext in tomcat
Date Mon, 25 Apr 2011 08:11:10 GMT
you are missing the point. if you have jndi.properties on your classpath,
then that value is used by default. you don't need to look it up, the jre
looks it up for you

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 25 Apr 2011 03:21, "Mansour Al Akeel" <mansour.alakeel@gmail.com> wrote:
> Ok, but I still have to load the
> properties from the file, and pass it to the InitialContext constructor
> every time I need to create an InitialContext.
>
> This wouldn't give the desired effect.
>
> On Mon Apr 25,2011 03:53 am, Yegor Bugayenko wrote:
>> You can (and should) store the value into jndi.properties file, and make
it
>> available in classpath.
>>
>> ?
>> Yegor Bugayenko
>>
>>
>> On Sun, Apr 24, 2011 at 9:10 PM, Mansour Al Akeel <
mansour.alakeel@gmail.com
>> > wrote:
>>
>> > 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message