You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonathan Wright <jo...@aboutit.co.nz> on 2004/11/11 23:46:22 UTC

JNDI

Hi,

Just a quick question about JNDI in a Struts setting. I want to reduce the
dependencies between objects in my app. Some objects that are not servlet
aware need access to the ServletContext and DataSources. However rather than
complicating matters and increasing the number of arguments I need to pass
around I'm thinking of putting references to DataSources and the
ServletContext into a JNDI context.

Which JNDI SPI would you recommend for a simple object registry/store? What
are the issues regarding the Referenceable interface?

Thanks in advance.

Jonathan Wright


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: JNDI

Posted by Jonathan Wright <jo...@aboutit.co.nz>.
Craig,

Thanks for the prompt reply. I have in the past set up DataSources in
Tomcat's server-config.xml. However, due to the nature of our production
environment I don't want to edit this file. It's relatively important that
my web apps are completely self contained.

Jonathan Wright

----- Original Message -----
From: "Craig McClanahan" <cr...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, November 12, 2004 11:57 AM
Subject: Re: JNDI


> On Fri, 12 Nov 2004 11:46:22 +1300, Jonathan Wright
> <jo...@aboutit.co.nz> wrote:
> > Hi,
> >
> > Just a quick question about JNDI in a Struts setting. I want to reduce
the
> > dependencies between objects in my app. Some objects that are not
servlet
> > aware need access to the ServletContext and DataSources. However rather
than
> > complicating matters and increasing the number of arguments I need to
pass
> > around I'm thinking of putting references to DataSources and the
> > ServletContext into a JNDI context.
> >
> > Which JNDI SPI would you recommend for a simple object registry/store?
What
> > are the issues regarding the Referenceable interface?
>
> Why not use the JNDI naming context provided by your container?  You
> shouldn't have to be worried about implementing this -- just configure
> the JNDI resources that you want to make available to your
> application.
>
> For example, the instructions for using the naming context provided by
Tomcat:
>
>
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
>
> and specific info about using a data source provided by Tomcat:
>
>
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html
>
> Other servers will have their own mechanisms for configuring these things.
>
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: JNDI

Posted by Craig McClanahan <cr...@gmail.com>.
On Fri, 12 Nov 2004 11:46:22 +1300, Jonathan Wright
<jo...@aboutit.co.nz> wrote:
> Hi,
> 
> Just a quick question about JNDI in a Struts setting. I want to reduce the
> dependencies between objects in my app. Some objects that are not servlet
> aware need access to the ServletContext and DataSources. However rather than
> complicating matters and increasing the number of arguments I need to pass
> around I'm thinking of putting references to DataSources and the
> ServletContext into a JNDI context.
> 
> Which JNDI SPI would you recommend for a simple object registry/store? What
> are the issues regarding the Referenceable interface?

Why not use the JNDI naming context provided by your container?  You
shouldn't have to be worried about implementing this -- just configure
the JNDI resources that you want to make available to your
application.

For example, the instructions for using the naming context provided by Tomcat:

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

and specific info about using a data source provided by Tomcat:

  http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Other servers will have their own mechanisms for configuring these things.

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org