You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Gavin, Rick" <RG...@vidyah.com> on 2002/12/06 15:49:38 UTC

[4.1.12] How to Implement Custom JNDI Tree?

Hi All,
  I have implemented a JNDI tree for my sites configuration options since
the built in tomcat context can not be modified at runtime( unless something
changed ). Can anyone tell me what the best way to implement the use of it.
Currently I have a static Settings class that has a DirContext property that
is the InitialContext of the Tree.  I also tried setting the root context
object as a property of tomcats ServletContext so I'm able to request it
from within a JSP or servlet with out using the static object.  But both
ways seem a little clunky.  tomcat uses a URL to get to its own initial
context..   [ Context envCtx = (Context) initCtx.lookup("java:comp/env"); ]
.  I looked at the URL binding and I thought I would ask if that's the right
( best ) way to go before I spent time on it..

Thanks for any help,

Rick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [4.1.12] How to Implement Custom JNDI Tree?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 6 Dec 2002, Gavin, Rick wrote:

> Date: Fri, 6 Dec 2002 06:49:38 -0800
> From: "Gavin, Rick" <RG...@vidyah.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: "Tomcat Users List (E-mail)" <to...@jakarta.apache.org>
> Subject: [4.1.12] How to Implement Custom JNDI Tree?
>
> Hi All,
>   I have implemented a JNDI tree for my sites configuration options since
> the built in tomcat context can not be modified at runtime( unless something
> changed ). Can anyone tell me what the best way to implement the use of it.
> Currently I have a static Settings class that has a DirContext property that
> is the InitialContext of the Tree.  I also tried setting the root context
> object as a property of tomcats ServletContext so I'm able to request it
> from within a JSP or servlet with out using the static object.  But both
> ways seem a little clunky.  tomcat uses a URL to get to its own initial
> context..   [ Context envCtx = (Context) initCtx.lookup("java:comp/env"); ]
> .  I looked at the URL binding and I thought I would ask if that's the right
> ( best ) way to go before I spent time on it..
>

It would be feasible to add your configuration DirContext as a subcontext
of the one Tomcat provides to your app if you wanted to.  See the docs:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

especially the part about using your own resource factory.

> Thanks for any help,
>
> Rick

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>