1 Reply Latest reply on Jul 21, 2003 4:55 PM by Toby Reyelts

    Loaded libraries invoking ClassLoader.loadClassInternal dire

    Toby Reyelts Newbie

      I recently developed a tool that lets me detect and instrument thrown exceptions at runtime. Basically, you run the tool in another process space, and it uses JDI to add hooks to the server virtual machine to detect whenever an exception is thrown (regardless of whether or not that exception is eventually caught). Normally, I'm able to filter out exceptions which aren't of interest to the user by walking the stack-trace of the exception to see if any of the methods in the stacktrace were invoked on user classes.

      Unfortunately, when I started using this tool with JBoss, I was getting thousands of "false" hits, because of some very weird behavior in user classes. If you look at the bottom of this message, you can see an example of the kinds of exceptions I'm catching. In that stacktrace, you can see that a JSP is calling a tag library (just dandy), but when that tag library gets called (CUIDSkinFactory.getPanelSkinner), it ends up resulting in a ClassNotFoundException. The thing is, the stack-trace shows that CUIDSkinFactory is making a direct call to ClassLoader.loadClassInternal, but that doesn't make any sense, because the code that the user compiled _does not_ call ClassLoader.loadClassInternal (which, btw, is a private method of ClassLoader).

      So, what I imagine has happened here, is that JBoss is doing some funky bytecode modification on the classes as they are being loaded. That modification includes a call to ClassLoader.loadClassInternal. Am I on the right track? Can somebody explain this behavior to me?

      God bless,
      -Toby

      Exception: java.lang.ClassNotFoundException: com/baan/components/jsptags/skins/CUID/CUIDSkinFactory$2
      at java.lang.ClassLoader.findBootstrapClass(Native Method)
      at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:723)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:292)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
      at com.baan.components.jsptags.skins.CUID.CUIDSkinFactory.getPanelSkinner(CUIDSkinFactory.java:86)
      at com.baan.components.jsptags.basic.PanelTag.getComponentSkinner(PanelTag.java:113)
      at com.baan.components.jsptags.basic.AbstractSkinnableTag.doStartTag(AbstractSkinnableTag.java:77)
      at org.apache.jsp.login_jsp._jspx_meth_baan_panel_0(login_jsp.java:182)
      at org.apache.jsp.login_jsp._jspx_meth_html_form_0(login_jsp.java:158)
      at org.apache.jsp.login_jsp._jspx_meth_html_html_0(login_jsp.java:115)
      at org.apache.jsp.login_jsp._jspService(login_jsp.java:85)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
      at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:124)
      at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
      at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
      at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:818)
      at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
      at org.apache.jsp.layout_jsp._jspx_meth_tiles_insert_8(layout_jsp.java:528)
      at org.apache.jsp.layout_jsp._jspService(layout_jsp.java:310)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
      at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
      at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)
      at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249)
      at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303)
      at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
      at java.lang.Thread.run(Thread.java:536)