0 Replies Latest reply on Sep 6, 2012 4:05 AM by julien_viet

    Tomcat7 Embedded classloading issue

    julien_viet

      Hi,

       

      I'm having this issue when using embedded TC7 1.0.0.CR3:

       

       

      Caused by: java.lang.ClassNotFoundException: org.apache.catalina.deploy.ServletDef
                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
                at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:799)
                at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
                at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1057)
                ... 151 more
      

       

      It works fine with TC6 but fails in TC7, one difference is that the WebappClassLoader does not have the same parent : TC6:surefire and TC7:system

       

      I looked at the ARQ code and can see in TC6 in TomcatContainer#deploy:

       

       // Need to tell TomCat to use TCCL as parent, else the WebContextClassloader will be looking in AppCL
       standardContext.setParentClassLoader(Thread.currentThread().getContextClassLoader();
      

       

      The same code does not appear in TomcatContainer for TC7.

       

      Any idea if this is broken or if I'm doing something wrong ?