Hi Jaroslav, You mean to say btrace is using Instrumentation.appendToBootstrapClassLoaderSearch?
How is this going to work with OSGi then? Kirk On Apr 1, 2011, at 8:32 AM, Jaroslav Bachorik wrote: > Ok, the culprit is the compiled script class - HomeTracer$0. This > class is loaded by the bootstrap class loader - it seems as the > EnvironmentClassLoader prevents delgating to the bootstrap class > loader :( > > -JB- > > On Mar 31, 5:13 am, "[email protected]" <[email protected]> > wrote: >> The Spring is not on the system classpath,it's on the WEB-INF/lib. >> >> I copy the Spring libs to the ${resin.home}/ext-webapp-lib and remove them >> from the WEB-INF/lib,the exception stacktrace still there,can't solve the >> problem. >> >> Thanks. >> >> >> >> >> >> >> >> >> >> On Thu, Mar 31, 2011 at 1:08 AM, Kirk <[email protected]> wrote: >>> 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 visihttp://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(DispatcherServ >>> let.java:839) >>> at >>> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServl >>> et.java:719) >>> at >>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkSe >>> rvlet.java:644) >>> at >>> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.jav >>> a: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.j >>> ava:103) >>> Caused by: java.lang.NoClassDefFoundError: HomeTracer$0 >>> at >>> com.test.HomeController.$btrace$HomeTracer$0$onEntryIndex(HomeController.ja >>> va) >>> at com.test.HomeController.index(HomeController.java) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 >>> 9) >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp >>> l.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> at >>> org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invoke >>> HandlerMethod(HandlerMethodInvoker.java:176) >>> at >>> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapt >>> er.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) >>> at >>> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapt >>> er.handle(AnnotationMethodHandlerAdapter.java:414) >>> at >>> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServ >>> let.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. >> >> -- >> 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.
