ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Mall ...@arcus.com.au>
Subject RE: NoClassDefFoundError exception on when <taskdef> is invoked a second time
Date Thu, 11 Dec 2003 09:05:55 GMT
Phillipe,

I sent the stack trace in a previous post.

Here is a.xml:

<project name="oscar" default="compile">
  <property name="tomcat.home" location="/usr/local/jakarta-tomcat"/>
  <target name="compile" depends="internet, intranet, syndication" />
  <target name="internet">
    <ant antfile="b.xml" target="jspc">
      <property name="webapp.name" value="internet" />
      <property name="webapp.host" value="intertest.arcus.com.au" />
    </ant>
  </target>
  <target name="intranet">
    <ant antfile="b.xml" target="jspc">
      <property name="webapp.name" value="intranet" />
      <property name="webapp.host" value="intratest.arcus.com.au" />
    </ant>
  </target>
  <target name="syndication">
    <ant antfile="b.xml" target="jspc">
      <property name="webapp.name" value="syndication" />
      <property name="webapp.host" value="syndtest.arcus.com.au" />
    </ant>
  </target>
</project>

And here is b.xml:

<project name="tomcat precompile" default="jspc" basedir=".">
    <property name="tomcat.home" location="${tomcat.home}"/>
    <property name="webapp.name" value="${webapp.name}" />
    <property name="webapp.host" value="${webapp.host}" />
    <property name="webapp.path"
location="/data01/oscar/${webapp.name}/htdocs" />

    <target name="jspc">
        <echo>Precompiling application ${webapp.name} from
${webapp.path} using tomcat in ${tomcat.home}</echo>
        <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
            <classpath id="jspc.classpath">
                <pathelement
location="${java.home}/../lib/tools.jar"/>
                <fileset dir="${tomcat.home}/bin">
                    <include name="*.jar"/>
                </fileset>
                <fileset dir="${tomcat.home}/server/lib">
                    <include name="*.jar"/>
                </fileset>
                <fileset dir="${tomcat.home}/common/lib">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
        </taskdef>

        <delete dir="${webapp.path}/WEB-INF/src" />

        <jasper2
             validateXml="false"
             uriroot="${webapp.path}"
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             outputDir="${webapp.path}/WEB-INF/src"
             package="org.apache.jsp">
        </jasper2>

        <echo>Compiling generated classes from JSPC in:
${webapp.path}/WEB-INF/src</echo>
        <javac destdir="${webapp.path}/WEB-INF/src"
               optimize="off"
               debug="on"
               failonerror="false"
               srcdir="${webapp.path}/WEB-INF/src"
               >
            <classpath>
                <pathelement
location="${webapp.path}/WEB-INF/classes"/>
                <fileset dir="${webapp.path}/WEB-INF/lib">
                    <include name="*.jar"/>
                </fileset>
                <pathelement
location="${tomcat.home}/common/classes"/>
                <fileset dir="${tomcat.home}/common/lib">
                    <include name="*.jar"/>
                </fileset>
                <pathelement
location="${tomcat.home}/shared/classes"/>
                <fileset dir="${tomcat.home}/shared/lib">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
            <include name="**/*.java" />
        </javac>

    </target>
</project>
-----Original Message-----
From: Philippe Valle [mailto:pvalle@eprocess.fr]
...
when you do : ant -v a.xml what kind error did you have exactly ?
For debug send me a.xml , b.xml and logs.

Manuel Mall wrote:

>Philippe,
>
>this is exactly what's puzzling me. How can it be a classpath error
>when it works the first time around?
>
>Manuel
>
>-----Original Message-----
>From: Philippe Valle [mailto:pvalle@eprocess.fr]
>...
>This is an classpath error. Check your classpath
>
>
>Manuel Mall wrote:
>
>  
>
>>I have a buildfile a.xml which calls b.xml through an <ant> task a
>>number of times. b.xml contains a <taskdef> which contains a nested
>><classpath..>.
>>
>>On the first invocation of b.xml through the <ant> task in a.xml
>>everything works fine. However, the second time around I get a
>>NoClassDefFoundError exception on the <taskdef> in b.xml. 
>>
>>I am not sure what I might be doing wrong here. 
>>
>>Manuel
>>
>>Some more info:
>>===============
>>I am using ant 1.5.4..
>>
>>The abbreviated ant output is:
>>...
>>jspc: <-- this is the first invocation of b.xml
>>    [echo] Precompiling application internet from
>>/data01/oscar/internet/htdocs using tomcat in
>>/usr/local/jakarta-tomcat
>>...
>>   [javac] Compiling 103 source files to
>>/data01/oscar/internet/htdocs/WEB-INF/src
>>...
>>jspc:  <-- this is the second invocation of b.xml
>>    [echo] Precompiling application intranet from
>>/data01/oscar/intranet/htdocs using tomcat in
>>/usr/local/jakarta-tomcat
>>
>>BUILD FAILED
>>file:/home/mm/oscar/build_current/b.xml:37: Could not create task of
>>type: jasper2 due to java.lang.NoClassDefFoundError
>>
>>---
>>
>>The taskdef in b.xml looks like:
>>
>>       <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
>>           <classpath id="jspc.classpath">
>>               <pathelement
>>location="${java.home}/../lib/tools.jar"/>
>>               <fileset dir="${tomcat.home}/bin">
>>                   <include name="*.jar"/>
>>               </fileset>
>>               <fileset dir="${tomcat.home}/server/lib">
>>                   <include name="*.jar"/>
>>               </fileset>
>>               <fileset dir="${tomcat.home}/common/lib">
>>                   <include name="*.jar"/>
>>               </fileset>
>>           </classpath>
>>       </taskdef>
>>
>>---
>>
>>I also tried using the latest ant 1.6 beta 3 and it fails the
>>following error on the second invocation of b.xml:
>>
>>BUILD FAILED
>>/home/mm/oscar/build_current/a.xml:19: Following error occured while
>>executing this line
>>java.lang.ExceptionInInitializerError
>>
>>--------------------------------------------------------------------
-
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>> 
>>
>>    
>>
>
>
>  
>


-- 
Philippe  VALLE <pvalle@eprocess.fr>
Server Project Manager - e'process
Tel: +33 (0)4 67 13 84 65



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message