3 Replies Latest reply on Jan 11, 2005 8:50 AM by starksm64

    Tomcat and ClassLoader Problems

    brownjava

      I'm having some problems scoping my WAR file for the JBoss ClassLoader as per the instructions in the wiki at "http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration". Basically, my application ships with a version of dom4j that seems to conflict with the dom4j in "/lib", so I want to override this system jar inside my war file.

      I followed the instructions as closely as possible (I think), and ended up with the following jboss-web.xml:


      <?xml version='1.0' encoding='UTF-8' ?>

      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">

      <jboss-web>
      <context-root>/</context-root>

      <class-loading java2ClassLoadingCompliance="false">
      <loader-repository>dot.com:loader=app1
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      </loader-repository>
      </class-loading>

      </jboss-web>



      This seemed to work fine, until I physically deleted my application's .war file from the deployment directory ("/server/default/deploy") and redeployed. Now every time I hit the application, I get an error page from Tomcat containing the following (warning, it's long):

      HTTP Status 500 -

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      org.apache.jasper.JasperException: Unable to compile class for JSP
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:520)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      com.brownjava.app1.SiteDefinitionFilter.doFilter(Unknown Source)
      com.brownjava.app1.VirtualHostFilter.doFilter(Unknown Source)
      com.brownjava.app1.DomainVerificationFilter.doFilter(Unknown Source)
      com.brownjava.app1.LocaleFilter.doFilter(Unknown Source)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

      root cause

      java.lang.ClassCastException
      javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:93)
      org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:91)
      org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:70)
      org.apache.jasper.compiler.JspConfig.init(JspConfig.java:188)
      org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:240)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:160)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      com.brownjava.app1.SiteDefinitionFilter.doFilter(Unknown Source)
      com.brownjava.app1.VirtualHostFilter.doFilter(Unknown Source)
      com.brownjava.app1.DomainVerificationFilter.doFilter(Unknown Source)
      com.brownjava.app1.LocaleFilter.doFilter(Unknown Source)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

      note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
      Apache Tomcat/5.0.28



      Anyone else experienced anything like this? Am I causing classes that should be available to Tomcat not to be available? Note that there are four filters running before the JSP is compiled, leading me to believe that Tomcat is running in the scope specified for my WAR file (which doesn't seem right).

      The only other option I have is to copy my applicaton's "dom4j.jar" over the stock "dom4j.jar" provided in "/lib". This fixes this problem altogether, but it is kind of a messy solution.