Boy, it would be nice if I had documented this when I did the work....
The context parameter and BasicServletConfiguration work in a 2.2
environment... but I forgot a key detail when making my recommendation.
If the path given to the context parameter does not begin with "/WEB-INF/"
it assumes the path is an absolute path... so if you followed my
recommendation (a mistake you won't make again ;) it would have looked for
the configuration files in a directory off the root named "working"...
So change "/working" to an absolute path ... or move the files/directory
under WEB-INF - not very nice really, but the assumption, right or wrong,
was that configuration files would (should?) be under /WEB-INF.
Would "/WEB-INF/../working" work....?
Scott
-----Original Message-----
From: Kevin Dahlhausen [mailto:kdahlhau..ahoo.com]
Sent: Tuesday, November 18, 2003 12:59 PM
To: cayenne-use..bjectstyle.org
Subject: RE: Configuring Basic Servlet Config
Thanks Scott. Of course we're using websphere 4.0 with its Servlet api
at 2.2. That might be why this option isn't working.
--- Scott Finnerty <scot..odefuey.com> wrote:
> Actually I was a little off - you can just use the context parameter
> -
> BasicServletConfiguration will look for that, assuming you provide
> the
> ServletContext. The listener is good for a Servlets 2.3+ environment
> (e.g.,
> Tomcat 4.x+) instead of an initialization servlet.
>
> Scott
>
> -----Original Message-----
> From: Scott Finnerty [mailto:scot..odefuey.com]
> Sent: Tuesday, November 18, 2003 9:46 AM
> To: cayenne-use..bjectstyle.org
> Subject: RE: Configuring Basic Servlet Config
>
> You can use org.objectstyle.cayenne.conf.WebApplicationListener as a
> context
> listener which will look for a context parameter to add to the path
> for
> configuration files. It will also initialize the configuration when
> the
> context is started.
>
> In your web.xml, add
>
> <context-param>
> <param-name>cayenne.configuration.path</param-name>
> <param-value>/working</param-value>
> </context-param>
>
> and
>
> <listener>
> <listener-class>
> org.objectstyle.cayenne.conf.WebApplicationListener
> </listener-class>
> </listener>
>
> I don't have anything to offer on the JNDI datasource w/o
> authentication
> credentials... sorry.
>
> Another question that has been asked on the list (not necessarily in
> relation to web apps) is how to use an existing commons/log4j
> configuration
> instead of the cayenne canned one. I extended
> BasicServletConfiguration and
> overrode "configureLogging()" with an empty implementation and then
> extended
> WebApplicationListener and overrode "newConfiguraton(ServletContext)"
> to
> return my own BasicServletConfiguration. Then instead of the cayenne
> WebApplicationListener, I configured for my extension.
>
> Scott
>
> -----Original Message-----
> From: Kevin Dahlhausen [mailto:kdahlhau..ahoo.com]
> Sent: Tuesday, November 18, 2003 9:02 AM
> To: cayenne-use..bjectstyle.org
> Subject: Configuring Basic Servlet Config
>
> Cayenne is great! I'm pushing hard to have it replace our in-house
> database abstraction library. One area that is causing trouble
> though
> is that I'm having trouble configuring a non-default location of
> cayenne.xml. Our standards dictate that the file should be in
> working:
>
> webApplication
> |
> |
> +-- WEB-INF
> |
> +-- working
> |
> +-- cayenne.xml
>
> After trying all kinds of permuations of addClassPath and
> FileConfiguration, I've not been able to have cayenne locate the
> file.
>
> I'm using BasicServletConfiguration.
>
> in the servlet's init:
>
> DefaultConfiguration conf =
>
BasicServletConfiguration.initializeConfiguration(config.getServletContext()
> );
> conf.addClassPath("../working");
>
> Could anyone steer me in the right direction on this?
>
>
> Also, is there any way to use a JNDI data source that is not
> pre-configured with a username and password? That is to pass the
> user
> name and password when a connection is created? If not, that is
> something I'll be adding if this goes through.
>
> Thanks.
>
>
>
> =====
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Kevin Dahlhausen 'Do' or 'do not.' There is no 'Try.'
> http://members.nccw.net/kdahlhaus/ -Yoda
>
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
>
>
>
>
=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Dahlhausen 'Do' or 'do not.' There is no 'Try.'
http://members.nccw.net/kdahlhaus/ -Yoda
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
This archive was generated by hypermail 2.0.0 : Tue Nov 18 2003 - 16:34:21 EST