Community
Participate
Working Groups
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.
Created attachment 152578 [details] Eceptions when Tomcat V6 starts
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?
> 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?
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.
exclusion seems ok for now. perhaps doc the problem on next doc update.