tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neo anderson <>
Subject Re: Class loading question (with aspectj)
Date Fri, 04 Sep 2009 09:40:13 GMT

I do not put the same class i.e. in both location
(WEB-INF/classes and WEB-INF/lib). 

The way how I test is by copying to another foler under
WEB-INF/classes and renaming it to another name e.g. 

Then configure web.xml to use MyTapestryFilter in <filter> ...</filter> tag.

The aspectj code will get printed if web.xml uses MyTapestryFilter class,
but those code won't be printed if web.xml use default TapestryFilter class.

I look up the source code and just notice one thing that makes me confused. 

My aspectj code e.g. is located under WEB-INF/classes
folder and is packaged as lib and located under
WEB-INF/lib folder. 

What caught my attention is when I startup tomecat server version 6.0.20 (I
build it from scratch), the WebappLoader.setRepositories() looks like does
not load because it doesn't show e.g. get loaded (or it is because setRepositories only
load jar files?) as below.

-------------------> setRepositories(): WEB-INF/classes/
-----------------> addJar(): jarRealFiles.length:0

Then it starts to laod jar files under WEB-INF/lib

-------------------> setRepositories(): WEB-INF/lib
loaderRepositories:[/WEB-INF/classes/, /WEB-INF/lib/antlr-2.7.6.jar]
-----------------> addJar(): jarRealFiles.length:1
-----------------> addJar():

Does this mean the class ( compilied aspectj code ) is not loaded? Or where
should I look up so that I can check if it is because the tapestry jar files
get loaded, but not my aspectj code (located under WEB-INF/classes)? 

I appreciate any suggestion.

Many thanks.

markt-2 wrote:
> neo anderson wrote:
>> I read the document at
>> and have
>> a
>> question. What is the class loading order if the classes are located
>> under
>> /WEB-INF/classes/ and /WEB-INF/lib/ respectively? 
> The search order is always:
> /WEB-INF/classes
> /WEB-INF/lib
> You can distribute your classes between those locations any way you like
> but if you put the same class in both locations, the one in classes will
> always take priority.
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Tomcat - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message