tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Williams <nicho...@nicholaswilliams.net>
Subject Re: /META-INF/context.xml seemingly ignored
Date Sun, 04 Aug 2013 00:27:58 GMT

On Aug 3, 2013, at 6:05 PM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Nick,
> 
> On 8/3/13 2:54 PM, Nick Williams wrote:
>> I'm using Tomcat 8.0.0-RC1. Hopefully I'm just missing something 
>> here. I created a web application with the following 
>> /META-INF/context.xml file (I tried both with and without the 
>> path="/support" attribute).
>> 
>> 
>> <?xml version='1.0' encoding='utf-8'?> <Context path="/support"> 
>> <Loader
>> loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
>> 
>> 
> </Context>
> 
> If you are using META-INF/context.xml, then the "path" attribute is
> definitely illegal/ignored.
> 
> I haven't read the Javadoc for Tomcat 8 yet, but I think you want:
> 
>   <Loader className="org.spring....Loader" />
> 
> Instead of "loaderClass". At least, that's what it would have been for
> Tomcat 7.

className is for specified a different Loader implementation. loaderClass is for specifying
a different ClassLoader. It's very confusing, but this is definitely right.

> 
>> The JAR containing the TomcatInstrumentableClassLoader is in 
>> TOMCAT_HOME/lib. However, when the application starts the class 
>> loader is still Tomcat's WebappClassLoader.
>> 
>> So, I moved the <Loader> element to TOMCAT_HOME/conf/context.xml
>> and now it works. When the application starts the class loader is
>> the TomcatInstrumentableClassLoader.
> 
> That's odd.
> 
>> Note that I have confirmed the context.xml file IS in META-INF at
>> the root of my web application (not in /WEB-INF/classes/META-INF).
>> I also noticed that TOMCAT_HOME/conf/Catalina/localhost is empty.
>> There are no files or other directories in that directory at all.
>> So, it would appear that my context.xml is not getting copied. I
>> don't know whether or not that matters. I am deploying my
>> application as an exploded directory (not a WAR), and it is in an
>> external directory (it is not in TOMCAT_HOME/webapps).
>> 
>> Am I doing something wrong here, or is this a bug?
> 
> Anything in the "work" directory? CATALINA_BASE/conf/[Engine]/[Host]/
> should be where context.xml files are copied, so .. this definitely
> looks fishy.

Yes. There's a TOMCAT_HOME/work/Catalina/localhost/support directory, but TOMCAT_HOME/conf/Catalina
is empty.

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


Mime
View raw message