You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov> on 2011/09/22 22:48:42 UTC

RE:[OT][tomcat-6.0.33] META-INF/context.xml Environment not working

>-----Original Message-----
>From: Tim Watts [mailto:tim@cliftonfarm.org]
>Subject: RE: [tomcat-6.0.33] META-INF/context.xml Environment not
>working
>
>I got it to work by removing the <env-entry> from web.xml. I believe
>this is a regression because it works correctly under 5.5.17. Under
>5.5.17 it finds the env entry with or without having defined in web.xml.
>Under 6.0.33 having the env entry defined in web.xml *prevents* it from
>finding it.
>

So what is the difference between having a <env-entry> or <resource-ref> in web.xml vs. a <Resource> or <Environment> elements in META-INF/context.xml?

Re: RE:[OT][tomcat-6.0.33] META-INF/context.xml Environment not working

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Thu, 2011-09-22 at 13:48 -0700, Leo Donahue - PLANDEVX wrote:
> So what is the difference between having a <env-entry> or
> <resource-ref> in web.xml vs. a <Resource> or <Environment> elements
> in META-INF/context.xml?

Well for starters, the web.xml entries will work in all web containers
whereas context.xml is Tomcat-specific.

But the main driver for me is that I want to deliver a .war that I can
drop into ANY web container and have the users configure the app WITHOUT
touching anything in the .war file. I only mentioned the
META-INF/context.xml approach in my original email to simplify the
discussion here. For Tomcat my real aim would be to drop the META-INF
thing and create an equivalent context.xml in
conf/Catalina/${hostname}/${myappcontext}.xml (this is also broke in
6.0.33). Most app servers provide a means of setting JNDI entries via a
web dashboard or a scriptable interface. Tomcat's Manager web interface
used to support this (or maybe it was an extra).

I believe the the Servlet spec says that <env|resource-ref> entries have
to be in web.xml because they tell the container how to expose JNDI
entries to the app in the java:comp/env context. So as 6.0.33 stands, if
I leave them out of web.xml my app works in Tomcat but it's broke
everywhere else. Not good.

I'm trying to see if I can find the problem and so far it's looking like
it might be in org.apache.catalina.startup.ContextConfig but nothing
definite. Not sure how long I'll pursue this. I've got a life to live
and a project to work on.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org