ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin J Citron <kev...@elp.rr.com>
Subject RE: Ant ClassLoader Woes
Date Mon, 17 Nov 2003 21:54:28 GMT
when doing an ant -debug build on the following build.xml

<project name="queryexamples" default="compile">

    <description>Hibernate Articles: Query Examples</description>

    <!-- Global -->
    <property name="classes" location="classes"/>
    <property name="lib" location="lib"/>
    <property name="src" location="src"/>

    <!-- SchemaExport -->
    <property name="mapping.files" location="${classes}/Cat.hbm.xml"/>

    <property name="db.dialect" 
value="net.sf.hibernate.dialect.MySQLDialect"/>
    <property name="db.driver" value="com.mysql.jdbc.Driver"/>
    <property name="db.url" value="jdbc:mysql://objectman:3306/epposDB"/>
    <property name="db.user" value="root"/>
    <property name="db.password" value=""/>


    <target name="compile"
            description="Compiles source files to build directory."
            depends="clean">
        <mkdir dir="${classes}"/>
        <javac srcdir="${src}" destdir="${classes}">
            <classpath>
                <fileset dir="${lib}">
                    <include name="**/*.jar" />
                </fileset>
            </classpath>
        </javac>
    </target>


    <target name="clean"
            description="Removes build directory.">
        <delete dir="${classes}/net"/>
    </target>


    <target name="initdb.mysql"
            description="Generates the database schema for MySQL."
            depends="compile">
        <java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" 
fork="true">

            <!-- Hibernate Properties -->
            <jvmarg value="-Dhibernate.dialect=${db.dialect}"/>
            <jvmarg 
value="-Dhibernate.connection.driver_class=${db.driver}"/>
            <jvmarg value="-Dhibernate.connection.url=${db.url}"/>
            <jvmarg value="-Dhibernate.connection.username=${db.user}"/>
            <jvmarg value="-Dhibernate.connection.password=${db.password}"/>

            <!-- Mapping Files -->
            <arg value="${mapping.files}"/>

            <classpath>
                <fileset dir="${lib}">
                    <include name="**/*.jar" />
                </fileset>
                <!-- Application Classpath -->
                <pathelement location="${classes}"/>
            </classpath>

       </java>
    </target>


</project>

I receive the following error out put
Apache Ant version 1.5 compiled on July 9 2002
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/j2sdk1.4.2_02/jre
Detected OS: Linux
Could not load class 
(org.apache.tools.ant.taskdefs.optional.PropertyFile) for task propertyfile
Could not load class 
(org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKIN) for task 
vsscheckin
 +User task: sql     org.apache.tools.ant.taskdefs.SQLExec
 +User task: cvspass     org.apache.tools.ant.taskdefs.CVSPass
Could not load class 
(org.apache.tools.ant.taskdefs.optional.perforce.P4Reopen) for task p4reopen
Could not load class 
(org.apache.tools.ant.taskdefs.optional.dotnet.CSharp) for task csc
 +User task: dirname     org.apache.tools.ant.taskdefs.Dirname
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLRun) 
for task wlrun
Could not load class 
(org.apache.tools.ant.taskdefs.optional.perforce.P4Label) for task p4label
Could not load class 
(org.apache.tools.ant.taskdefs.optional.perforce.P4Revert) for task p4revert
Could not load class 
(org.apache.tools.ant.taskdefs.optional.ReplaceRegExp) for task 
replaceregexp
Could not load class (org.apache.tools.ant.taskdefs.Get) for task get
Could not load class 
(org.apache.tools.ant.taskdefs.optional.javacc.JJTree) for task jjtree
 +User task: sleep     org.apache.tools.ant.taskdefs.Sleep
Could not load class 
(org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask) for 
task jarlib-display

//: There is more of the same Could not load class vomit

//: Then

BUILD FAILED
file:/tmp/java/hibernate/hibernate-examples/quickstart/java/build.xml:24: 
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
    at 
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:139)
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:833)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
    at org.apache.tools.ant.Task.perform(Task.java:317)
    at org.apache.tools.ant.Target.execute(Target.java:309)
    at org.apache.tools.ant.Target.performTasks(Target.java:334)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
    at org.apache.tools.ant.Main.runBuild(Main.java:610)
    at org.apache.tools.ant.Main.start(Main.java:196)
    at org.apache.tools.ant.Main.main(Main.java:235)


I did some exploring. It looks to me like there is a problem with the 
ClassLoader used by the taskdefs.
The failure to find a compiler is a result of this class method:
private static boolean doesModernCompilerExist() {
        try {
            Class.forName("com.sun.tools.javac.Main");
            return true;
        } catch (ClassNotFoundException cnfe) {
            return false;
        }
    }

Any help would be greatly appreciated.




-- 

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-7785/566-2403



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


Mime
View raw message