Bug 295586 - ajCore with LTW weaving Tomcat V6 example/servlet/session application
Summary: ajCore with LTW weaving Tomcat V6 example/servlet/session application
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6.7   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-19 09:02 EST by PASTUREL CLA
Modified: 2009-11-26 11:37 EST (History)
1 user (show)

See Also:


Attachments
ajcores (25.82 KB, application/x-zip-compressed)
2009-11-19 09:02 EST, PASTUREL CLA
no flags Details
Eceptions when Tomcat V6 starts (45.77 KB, text/plain)
2009-11-19 09:03 EST, PASTUREL CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description PASTUREL CLA 2009-11-19 09:02:00 EST
Created attachment 152577 [details]
ajcores

I wrote an LTW aspect that follows the size of HTTPSessions when they are
invalidated.
The javax weaving is set
I got a lot of exceptions at at the starting of Tomcat and ajcores. see joined
docs.
I use AspectJ Developpement of 16/11/2009
Using this aspect with Jonas with the same JVM ( 1.6.0_17 hotspot) ( a Tomcat
5.5. based WAS), the Aspect runs correctly without exceptions and without
ajcores. But certainly, the hierarchy of Classloaders is different than TOMCAT
standalone.
Comment 1 PASTUREL CLA 2009-11-19 09:03:14 EST
Created attachment 152578 [details]
Eceptions when Tomcat V6 starts
Comment 2 PASTUREL CLA 2009-11-19 10:12:36 EST
I solve the problem by excluding the package org.apache.juli.** in the the weaver tag of aop.xml file. ( java.lang.ClassCircularityError in class org/apache/juli/ClassLoaderLogManager$2 )

But with Tomcat to correctly weave HTTPSession and HTTPSessionListener ( and all javax servlet classes), we have to add servlet-api.jar in the classpath. Is there another way?

Does this bug can be closed?
Comment 3 Andrew Clement CLA 2009-11-19 11:44:03 EST
> I solve the problem by excluding the package org.apache.juli.** in the the
> weaver tag of aop.xml file. ( java.lang.ClassCircularityError in class
> org/apache/juli/ClassLoaderLogManager$2 )

That ClassCircularity problem looks pretty nasty - if you are happy to exclude those classes, that sounds a good solution, otherwise we need to pick apart that class and see why there is a circularity problem.  On first glance it doesn't look like AspectJ is to blame for causing the circularity problem - what do you think?


> But with Tomcat to correctly weave HTTPSession and HTTPSessionListener ( and
> all javax servlet classes), we have to add servlet-api.jar in the classpath. Is
> there another way?

How are your pointcuts expressed, if your pointcuts and advice make absolutely no explicit mention of a type in servlet-api.jar then we may be able to get to a mode that doesn't require it.  But I don't know which part of your pointcuts will be leading to them being required by the weaver - if you are able to narrow it down to the specific component (eg. is it because you use parameter pattern X or return type Y) then we could feasibly work towards removing the need to have it.

is it a problem to have servlet-api.jar around?
Comment 4 PASTUREL CLA 2009-11-19 12:45:31 EST
Thanks Andy.
For pb of Circularity, the exclusion of the package is sufficient. I can't answer at your question, perhaps the apache/Tomcat developpers can.

For the need of servlet-api.jar, yes the pointcut explicitly towards  the package servlet-api.jar as shown below :

pointcut methods(HttpSessionEvent hev): 
		execution( public 	* javax.servlet.http.HttpSessionListener.sessionDestroyed(HttpSessionEvent))
		&& args(hev);

HttpSessionEvent and HttpSessionListener belong to the package servlet-api.jar.

So no problem to add servlet-api.jar à the bootstrap classpath for Tomcat

I think you can close this bug, and remenber perhaps ( on FAQ)  the solution for Tomcat when weaving  javax servlet classes.
Comment 5 Andrew Clement CLA 2009-11-26 11:37:27 EST
exclusion seems ok for now.  perhaps doc the problem on next doc update.