Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Weaving into more classes than it should?

Hi all,

I have a JAR that comes with GlassFish (webservices-osgi.jar) and
within this jar, there's a class by the name of
com.sun.xml.ws.transport.http.servlet.ServletAdapter.

What I'm trying to do is to capture all executions of the method
handle() within this class, so that means ServletAdapter.handle(...).

The thing is, I have the following aspect (which I've tried to strip
to barebones):
---------------------8<-------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Calendar;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public aspect SoapAspect {
	pointcut handlerInvoked() :
		 execution(public void
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletContext,
HttpServletRequest, HttpServletResponse))
		 && target(com.sun.xml.ws.transport.http.servlet.ServletAdapter);
	   before() : handlerInvoked()
	   {
                //(...)
           }
}
---------------------8<-------------------------------

And whenever I try to weave this simple aspect into the JAR, I get a
few dozen errors about it not being able to determine the supertype of
classes that aren't even related to the class I'm weaving. Here's an
example of one of such errors (there's 34 in total):
---------------------8<-------------------------------
C:\glassfishv3\glassfish\modules\webservices-osgi.jar [error] can't
determine superclass of missing type org.apache.tools.ant.Task
when weaving type com.sun.xml.ws.installer.UpdateSharedLoaderProp
when weaving classes
when weaving
when batch building BuildConfig[null] #Files=1 AopXmls=#0
 [Xlint:cantFindType]
(no source information available)
        [Xlint:cantFindType]
---------------------8<-------------------------------

You can have a look at the ServletAdapter class here
(http://www.docjar.com/html/api/com/sun/xml/ws/transport/http/servlet/ServletAdapter.java.html)
and see that there's no reference whatsoever to either Task or
UpdateSharedLoaderProp.

Am I missing something stupidly obvious in AspectJ? I thought whenever
I weaved an aspect with the "execution()" pointcut, I would just be
touching the target class; so if that's the case, why is ajc trying to
weave into other random classes?

Thanks in advance!

Tiago


Back to the top