Ok, another question.

Is Spring on the system classpath? Or do you have Resin load it?

It looks like BTrace might be using the context classloader to load stuff into 
Resin's classloader while Spring on the system classpath can't look down into 
that classloader. Try having Resin load Spring to see if that resolves the 
visibility issue.

Regards,
Kirk

On Mar 30, 2011, at 6:09 PM, [email protected] wrote:

> The HomeTracer is my btrace script:
> 
> import com.sun.btrace.annotations.*;
> 
> import static com.sun.btrace.BTraceUtils.*;
> 
> @BTrace
> public class HomeTracer {
>     @TLS
>     static long indexStartTime;
> 
>     @OnMethod(clazz = "com.test.HomeController", method = "index", location = 
> @Location(value = Kind.ENTRY))    public static void onEntryIndex() {
>         indexStartTime = timeNanos();
>     }       
> 
>     @OnMethod(clazz = "com.test.HomeController", method = "index", location = 
> @Location(value = Kind.RETURN))
>     public static void onExitIndex() {
>         print(strcat("home.index ns", str((timeNanos() - indexStartTime))));
>     }       
> }
> 
> After  the btrace attched to the jvm ,resin will output  the following 
> exception stacktrace when I visi http://localhost:8080/home.
> The same btrace script runs well at the Resin 4.0.
>  Maybe the classloader of resin has different behavior  between 3.1.8 and 4.0?
> 
> org.springframework.web.util.NestedServletException: Handler processing 
> failed; nested exception is java.lang.NoClassDefFoundError: HomeTracer$0
>       at 
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:839)
>       at 
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
>       at 
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
>       at 
> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
>       at 
> com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
> Caused by: java.lang.NoClassDefFoundError: HomeTracer$0
>       at 
> com.test.HomeController.$btrace$HomeTracer$0$onEntryIndex(HomeController.java)
>       at com.test.HomeController.index(HomeController.java)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
>       at 
> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
>       at 
> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
>       at 
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
>       ... 18 more
> Caused by: java.lang.ClassNotFoundException: HomeTracer$0 in 
> EnvironmentClassLoader[web-app:http://localhost:8080]
>       at 
> com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1224)
>       at 
> com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1203)
> 
> 
> On Wed, Mar 30, 2011 at 12:32 PM, Kirk <[email protected]> wrote:
> 
> On Mar 29, 2011, at 10:52 PM, Jaroslav Bachorik wrote:
> 
> > Which class can not be found? A BTrace internal class or a custom type
> > you use in the BTrace script?
> 
> I suspect that BTrace is picking up the system classloader instead of the 
> context classloader but I need to see the stacktrace to confirm.
> 
> Kirk
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.
> 
> 
> 
> 
> -- 
> d0ngd0ng
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to