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

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

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. FilterInterceptor.java is located under WEB-INF/classes
folder and TapestryFilter.java 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 FilterInterceptor.java because it doesn't show e.g.
FilterInterceptor.java get loaded (or it is because setRepositories only
load jar files?) as below.

-------------------> WebappLoader.java: setRepositories(): WEB-INF/classes/
loaderRepositories:[/WEB-INF/classes/]
-----------------> WebappClassLoader.java: addJar(): jarRealFiles.length:0

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


-------------------> WebappLoader.java: setRepositories(): WEB-INF/lib
loaderRepositories:[/WEB-INF/classes/, /WEB-INF/lib/antlr-2.7.6.jar]
-----------------> WebappClassLoader.java: addJar(): jarRealFiles.length:1
-----------------> WebappClassLoader.java: addJar():
jarRealFiles[0]:/home/jackson5/app/apache-tomcat-6.0-snapshot/webapps/jecommerce/WEB-INF/lib/antlr-2.7.6.jar
...


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
>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html 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: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Class-loading-question-%28with-aspectj%29-tp25288633p25291325.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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

Reply via email to