Bug 57558 - <validator> ant task throws NoClassDefFoundError - Tomcat 8.0.18
<validator> ant task throws NoClassDefFoundError - Tomcat 8.0.18
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Jasper
6.0.43
PC All
: P2 normal (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-02-10 15:39 UTC by Konstantin Kolinko
Modified: 2015-02-19 04:09 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2015-02-10 15:39:23 UTC
This has been reported on the users list

http://mail-archives.apache.org/mod_mbox/tomcat-users/201502.mbox/%3CCAHvOsHzPt9hK8iGSTfXCzCcUSMq4N0DH5o1WRzTFvW-pKdVRRg%40mail.gmail.com%3E
http://tomcat.markmail.org/thread/du5j6z54cw2pfdvz

<quote>
I'm using Tomcat 8.0.18.
I've following ant build.xml:

<import file="${tomcat.home}/bin/
catalina-tasks.xml"/>

   <target name="jspc">

    <jasper
             validateXml="false"
             uriroot="${webapp.path}"
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             outputDir="${webapp.path}/WEB-INF/src" />

  <validator path="${webapp.path}" />
...
  </target>

<jasper> task works great, but <validator> task throws
java.lang.NoClassDefFoundError: org/apache/catalina/Globals

</quote>


Searching the jars, "org/apache/catalina/Globals.class" is in catalina.jar, which is not listed in bin/catalina-tasks.xml

I think that catalina-tasks.xml shall list all jars from ${catalina.home}/lib/*.jar, instead of naming just a few of those.  Besides catalina.jar others that are missing are *-i18n-*.jar ones.
Comment 1 Mark Thomas 2015-02-10 20:35:38 UTC
Fixed in trunk and 8.0.x for 8.0.19 onwards.
Comment 2 Konstantin Kolinko 2015-02-10 21:01:28 UTC
This is observed on 7.0.59 and current 6.0.x as well. I will backport the fix.
Comment 3 Konstantin Kolinko 2015-02-10 21:02:24 UTC
Complete sample build.xml (to be put into $CATALINA_HOME):

[[[
<project default="jspc">
  <property name="tomcat.home" location="${basedir}" />
  <property name="webapp.path" location="${basedir}/webapps/examples" />

  <import file="${tomcat.home}/bin/catalina-tasks.xml"/>

   <target name="jspc">

    <jasper
             validateXml="false"
             uriroot="${webapp.path}"
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             outputDir="${webapp.path}/WEB-INF/src" />

    <validator path="${webapp.path}" />

  </target>
</project>
]]]
Comment 4 Konstantin Kolinko 2015-02-10 21:29:39 UTC
Fixed in Tomcat 7 by r1658815 and will be in 7.0.60.
Proposed for Tomcat 6.
Comment 5 Konstantin Kolinko 2015-02-10 21:35:45 UTC
For a record:

Stacktrace in Tomcat 6 is
[[[
build.xml:15: java.lang.NoClassDefFoundError: org
/apache/catalina/Globals
        at org.apache.catalina.ant.ValidatorTask.execute(ValidatorTask.java:95)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at ...
]]]

The line that refers the Globals class in ValidatorTask.java:

   Digester digester = DigesterFactory.newDigester(
           true, true, null, Globals.IS_SECURITY_ENABLED);
Comment 6 Konstantin Kolinko 2015-02-19 04:09:10 UTC
Fixed in Tomcat 6 by r1660788 and will be in 6.0.44 onwards.