[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: [NEWSDELIVER] Re: load time weaving with existing servlet




Debbie,

The problem is that your versions of AJDT and AspectJ are slightly out of
step, something that is inevitable during the development of the core
compiler. Which versions are you using? The solution is to use the new
org.aspectj.weaver plugin in your runtime environment, an approach that
will work when this bug is fixed:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=111597. The only guarantee we
currently make is between final versions of each project. However in future
we be able to identify which AspectJ M release an AJDT M release contains
which will help with compatibility.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

"Debbie Rinkevich" <drinkevich@xxxxxxxxxxx> on 05/10/2005 22:34:52

To:    undisclosed-recipients:;
cc:
Subject:    [NEWSDELIVER] Re: load time weaving with existing servlet



I've made some progress on at least getting the weaver to acknowledge I
want
to do something! However I end up with lots of exceptions (below).  Any
thoughts on why this is being thrown?
info weaving 'org/apache/catalina/security/SecurityClassLoad'

warning Register definition failed -- (BCException) malformed
org.aspectj.weaver.EffectiveSignature attribute java.io.EOFException

malformed org.aspectj.weaver.EffectiveSignature attribute
java.io.EOFException

org.aspectj.weaver.BCException: malformed
org.aspectj.weaver.EffectiveSignature attribute java.io.EOFException

at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:121)

at
org.aspectj.weaver.bcel.BcelAttributes.readAjAttributes(BcelAttributes.java:59)


at
org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java:106)

at org.aspectj.weaver.bcel.BcelMethod.<init>(BcelMethod.java:71)

at
org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectType.java:188)


at
org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:367)



"Debbie Rinkevich" <drinkevich@xxxxxxxxxxx> wrote in message
news:di0unb$akh$1@xxxxxxxxxxxxxxxxxxx
>I am trying to add an aspect to an existing servlet; where the servlet
does
>not know about the aspect in advance (i.e. it's already deployed) (Note: I

>was able to make this work if I created an eclipse project and put them in

>the same project prior to building my war file)
>
> I created a simple Hello World servlet (hwservlet) and deployed that war
> file to Tomcat. (5.5 using 1.5)
>
> I then created an aspect HttpServletMonitor  to listen to the doGet
> method. (code below)
>
> I placed
> - HttpServletMonitor.class file in hwservlet\web-inf\classes
> - aop.xml in hwservlet\META-INF (file below)
> - Added aspectj.jar and aspectjweaver.jar to Tomcat's classpath
>
-Dclasspath=c:\aspectj1.5\lib\aspectjrt.jar;c:\aspectj1.5\lib\aspectweaver.jar

> Added the javaagent parameter to tomcat:
>    -Djavaagent=c:\aspect1.5\lib\aspectjweaver.jar
>
> I restart Tomcat ... the HelloWorld servlet still works just file but the

> aspect is not executed. If I run Tomcat through Eclipse in debug mode, I
> can hit a breakpoint in the servlet, but not the aspect.
>
> What have I missed?
>
> Thanks
> Debbie
>
> *****
>
> public aspect HttpServletMonitor {
>
> /** Execution of any 'do' Servlet request methods. */
>   public pointcut monitoredOperation(Object operation) :
>     execution(void HttpServlet.do*(..)) && this(operation);
>
>   /** Advice that records statistics for each monitored operation. */
>   void around(Object operation) : monitoredOperation(operation) {
>       String threadId = Thread.currentThread().getName();
>       proceed(operation);
>   }
>
>   private void writeLog(){
>       // write a temp file to disk
>     }
>
>   public HttpServletMonitor(){   }
> }
>
> ***
>
> <aspectj>
>
>
> <aspects>
>
> <!-- declare existing aspects to the weaver -->
>
> <aspect name="HttpServletMonitor"/>
>
>
> </aspects>
>
> <weaver options="-verbose -XlazyTjp">
>
> <include within="HWServlet"/>
>
> </weaver>
>
>
> </aspectj>
>
>
>
>