3 Replies Latest reply on Jan 23, 2008 12:11 PM by Remy Maucherat

    JspRuntimeContext has invalid assumption of URLClassLoader

    Scott Stark Master

      I'm working on externalizing the class loader construction to the new deployer layer, but there are assumptions being made regarding URLClassLoaders. For example, in org.apache.jasper.compiler.JspRuntimeContext:

      15:14:45,816 INFO [TomcatDeployment] deploy, ctxPath=/invoker, vfsUrl=http-invoker.sar/invoker.war
      15:14:47,655 ERROR [[/invoker]] StandardWrapper.Throwable
      java.lang.ClassCastException: org.jboss.classloader.spi.base.BaseClassLoader
       at org.apache.jasper.compiler.JspRuntimeContext.<init>(JspRuntimeContext.java:113)
       at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:101)
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
       at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
       at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4072)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
       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:585)
       at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
       at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5357)
       at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:350)
      


      code:
       public JspRuntimeContext(ServletContext context, Options options) {
      
       this.context = context;
       this.options = options;
      
       // Get the parent class loader
       parentClassLoader =
       (URLClassLoader) Thread.currentThread().getContextClassLoader();
       if (parentClassLoader == null) {
       parentClassLoader =
       (URLClassLoader)this.getClass().getClassLoader();
       }
      


      This is only used for the compile classpath. I thought this was only used for the legacy javac style compiler, not the jdt memory based compiler. If that is the case this behavior needs to be suppressed when the jdt compiler is being used.