You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nick Williams <ni...@nicholaswilliams.net> on 2013/08/03 20:54:35 UTC

/META-INF/context.xml seemingly ignored

Guys,

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>

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.

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?

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


Re: /META-INF/context.xml seemingly ignored

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Aug 3, 2013, at 8:27 PM, Nick Williams <ni...@nicholaswilliams.net> wrote:

> 
> 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.

What does your <Host/> tag look like?  Do you have deployXML or copyXML set?

  http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Standard Implementation

Dan


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


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


RE: /META-INF/context.xml seemingly ignored

Posted by Martin Gainty <mg...@hotmail.com>.
Nicholas possibly CATALINA_BASE environment variable is missing? http://blog.andrewbeacock.com/2007/08/getting-tomcat-contexts-to-work-in.html

gotta love those brit techs!
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 
> Subject: Re: /META-INF/context.xml seemingly ignored
> From: nicholas@nicholaswilliams.net
> Date: Sun, 4 Aug 2013 14:47:49 -0500
> To: users@tomcat.apache.org
> 
> 
> On Aug 4, 2013, at 11:16 AM, Konstantin Kolinko wrote:
> 
> > 2013/8/4 Mark Thomas <ma...@apache.org>:
> >> On 04/08/2013 02:27, Nick Williams wrote:
> >>> 
> >>> 
> >>> Yes. There's a TOMCAT_HOME/work/Catalina/localhost/support directory, but TOMCAT_HOME/conf/Catalina is empty.
> > 
> > There should be conf/Catalina/localhost directory that is empty. (The
> > Catalina directory is not empty).
> 
> Yes, my bad. conf/Catalina/localhost exists but is empty.
> 
> > 
> >> 
> >> As expected for Tomcat 8. copyXML is false by default.
> >> 
> >> (Yes the default has changed again.)
> > 
> > Huh? The copyXML is false by default in Tomcat 7 as well. I do not see
> > any change here.
> > 
> > It might be good time to start migration guide page for Tomcat 8.
> 
> Agreed.
> 
> So, looking at this further, this might be an IntelliJ IDEA bug. I'm deploying the application using the Tomcat support in IDEA. IDEA creates a directory C:\Users\Nicholas\.IntelliJIdea12\system\tomcat\Unnamed_Customer-Support-v15\conf\Catalina\localhost and that directory contains support.xml with my context.xml contents. I'm betting it's not hooking that up properly. I'll research that route instead.
> 
> Sorry if I've wasted anyone's time looking into this.
> 
> Nick
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: /META-INF/context.xml seemingly ignored

Posted by Nick Williams <ni...@nicholaswilliams.net>.
On Aug 4, 2013, at 11:16 AM, Konstantin Kolinko wrote:

> 2013/8/4 Mark Thomas <ma...@apache.org>:
>> On 04/08/2013 02:27, Nick Williams wrote:
>>> 
>>> 
>>> Yes. There's a TOMCAT_HOME/work/Catalina/localhost/support directory, but TOMCAT_HOME/conf/Catalina is empty.
> 
> There should be conf/Catalina/localhost directory that is empty. (The
> Catalina directory is not empty).

Yes, my bad. conf/Catalina/localhost exists but is empty.

> 
>> 
>> As expected for Tomcat 8. copyXML is false by default.
>> 
>> (Yes the default has changed again.)
> 
> Huh? The copyXML is false by default in Tomcat 7 as well. I do not see
> any change here.
> 
> It might be good time to start migration guide page for Tomcat 8.

Agreed.

So, looking at this further, this might be an IntelliJ IDEA bug. I'm deploying the application using the Tomcat support in IDEA. IDEA creates a directory C:\Users\Nicholas\.IntelliJIdea12\system\tomcat\Unnamed_Customer-Support-v15\conf\Catalina\localhost and that directory contains support.xml with my context.xml contents. I'm betting it's not hooking that up properly. I'll research that route instead.

Sorry if I've wasted anyone's time looking into this.

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


Re: /META-INF/context.xml seemingly ignored

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/8/4 Mark Thomas <ma...@apache.org>:
> On 04/08/2013 02:27, Nick Williams wrote:
>>
>>
>> Yes. There's a TOMCAT_HOME/work/Catalina/localhost/support directory, but TOMCAT_HOME/conf/Catalina is empty.

There should be conf/Catalina/localhost directory that is empty. (The
Catalina directory is not empty).

>
> As expected for Tomcat 8. copyXML is false by default.
>
> (Yes the default has changed again.)

Huh? The copyXML is false by default in Tomcat 7 as well. I do not see
any change here.

It might be good time to start migration guide page for Tomcat 8.

Best regards,
Konstantin Kolinko

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


Re: /META-INF/context.xml seemingly ignored

Posted by Mark Thomas <ma...@apache.org>.
On 04/08/2013 02:27, Nick Williams wrote:
> 
> 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>

That needs some further investigation to find out what is going on. It
should work.


>>> 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).

That might be relevant. There have been a few changes to automatic
deployment to better support external locations.


>>> 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.

As expected for Tomcat 8. copyXML is false by default.

(Yes the default has changed again.)

Mark

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


Re: /META-INF/context.xml seemingly ignored

Posted by Nick Williams <ni...@nicholaswilliams.net>.
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


Re: /META-INF/context.xml seemingly ignored

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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.

> 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.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJR/Yy0AAoJEBzwKT+lPKRY67AP/0DCd1vlI6A3Et9rYDkstu2e
RyukiBRG0H+3JeoJ2SuHVNorjKesJV5LgjwopawXKRuCmkmuds5KV9HFtsrhzWoD
PWRFIvGU0RbBKbNisStcBQ5GxafOBKB8uta+HTPukVaOAkjD2jGjp/mE3n4DWfuu
xl73Ij/cwHeULSzrF0RRWm/sB508d8ZyVN17L7rwNTxzBVVoIHDybgYKrOEkyK+o
24/0qkbH3ROmRyzayaWQlqBJUQFgfgIgc5kN9HB710kkNNdECSzs8boMMp9yJL5J
K2MxHq79D4ZrmlqUQAIaM6bGot4qWfVy8iN/y3+GU/L4nmqtxEz9CEdRuLZ6WrB1
tujz1LFu1noVSHaE1CptiLAR72kTU6qCtsR28TJ0kfYUh9QgOWUpCl8Rs7ity3gH
Z5WwZJixHoUVCwSjYTndZEENeIVygNZ8LC6BZKvNS8sAaW3C5Lq0NbO0jBDCgV+G
qD78Hu8UUnZR8i0Vm9QpLYlC2FFPLLNNzCbyqJDClp69LcYxrgTnvk9IouNZDjmW
Vy7xe379AHnmqpF3ZYda2FwnLNe2wqaS6DhA+eEM6cU0uDhutW8KwjcsPSV1dHwi
P7yBINIwlGH3961Knu7lt/PyqpKroBFFr6fSdfGfShLVvla7Z8SZFqCYmZWxolVx
zc6AAqu9IicX6qjgooWa
=NFNC
-----END PGP SIGNATURE-----

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