ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14171] New: - AntClassLoader.initializeClass fails call to getConstructors
Date Fri, 01 Nov 2002 16:39:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14171>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14171

AntClassLoader.initializeClass fails call to getConstructors

           Summary: AntClassLoader.initializeClass fails call to
                    getConstructors
           Product: Ant
           Version: 1.5
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: smayhew@valdero.com


When you create an ant task using <antTask> on solaris the hack in 
AntClassLoader.initializeClass() fails if one of the Constructors in the 
defined task declares an exception it throws that must be loaded from the 
classpath specified to <antTask>.

Here is the <antTask> tag:
    <path id="xmlc.classpath">
        <pathelement location="${extlib}/xmlc.jar"/>
        <pathelement location="${extlib}/gnu-regexp.jar"/>
        <pathelement location="${extlib}/jtidy-xmlc.jar"/>
        <pathelement location="${extlib}/xerces-xmlc.jar"/>
    </path>
   <path id="xmlcTask.classpath">
        <pathelement 
location="${ENV.CONDOR_HOME}/tools/antTasks/anttasks.jar" />
        <path refid="xmlc.classpath" />
    </path>

	<taskdef name="xmlc" classname="com.valdero.ant.taskdefs.Xmlc" 
classpathref="xmlcTask.classpath"/>


Here is the output from Ant:

Detected Java version: 1.3 in: /u02/app/bea/jdk130/jre
Detected OS: SunOS
parsing buildfile /export/home/smayhew/condor/module/ui/build.xml with URI = 
file:/export/home/smayhew/condor/module/ui/build.xml
Project base dir set to: /export/home/smayhew/condor/module/ui
resolving systemId: 
file:/export/home/smayhew/condor/module/moduleBuildCommon.xml
 [property] Loading Environment ENV.
  [taskdef] taskDef Loaded class class com.valdero.ant.taskdefs.CastorSrcGen, 
AntClassLoader with 
classpath: /export/home/smayhew/condor/tools/antTasks/anttasks.jar:/export/home/
smayhew/condor/module/ui/build/classes:/export/home/smayhew/condor/external/lib/
JREngine.zip:/export/home/smayhew/condor/external/lib/activation.jar:/export/hom
e/smayhew/condor/external/lib/bsh.jar:/export/home/smayhew/condor/external/lib/c
lasses12.zip:/export/home/smayhew/condor/external/lib/classes12_g.zip:/export/ho
me/smayhew/condor/external/lib/cos.jar:/export/home/smayhew/condor/external/lib/
dbunit.jar:/export/home/smayhew/condor/external/lib/dtdparser.jar:/export/home/s
mayhew/condor/external/lib/exml.jar:/export/home/smayhew/condor/external/lib/gnu
-regexp.jar:/export/home/smayhew/condor/external/lib/j2ee-no-
dom.jar:/export/home/smayhew/condor/external/lib/jai_codec.jar:/export/home/smay
hew/condor/external/lib/jai_core.jar:/export/home/smayhew/condor/external/lib/ja
vatools.jar:/export/home/smayhew/condor/external/lib/jaws.jar:/export/home/smayh
ew/condor/external/lib/jcchart.jar:/export/home/smayhew/condor/external/lib/jdom
.jar:/export/home/smayhew/condor/external/lib/jh.jar:/export/home/smayhew/condor
/external/lib/jhall.jar:/export/home/smayhew/condor/external/lib/jive.jar:/expor
t/home/smayhew/condor/external/lib/jsearch.jar:/export/home/smayhew/condor/exter
nal/lib/jtidy-
xmlc.jar:/export/home/smayhew/condor/external/lib/junit.jar:/export/home/smayhew
/condor/external/lib/log4j.jar:/export/home/smayhew/condor/external/lib/mail.jar
:/export/home/smayhew/condor/external/lib/regexp.jar:/export/home/smayhew/condor
/external/lib/xalan.jar:/export/home/smayhew/condor/external/lib/xerces-
xmlc.jar:/export/home/smayhew/condor/external/lib/xlrd.jar:/export/home/smayhew/
condor/external/lib/xmlc.jar:/export/home/smayhew/condor/external/lib/castor.jar
:/export/home/smayhew/condor/build/lib/infrastructure.jar:/export/home/smayhew/c
ondor/build/lib/metadata.jar:/export/home/smayhew/condor/build/lib/repository.ja
r:/export/home/smayhew/condor/build/lib/repository-
ejb.jar:/export/home/smayhew/condor/build/lib/event.jar:/export/home/smayhew/con
dor/build/lib/event-
ejb.jar:/export/home/smayhew/condor/build/lib/decisionsupport.jar:/export/home/s
mayhew/condor/build/lib/decisionsupport-
ejb.jar:/export/home/smayhew/condor/tools/ant/lib/xml-
apis.jar:/export/home/smayhew/condor/tools/ant/lib/xercesImpl.jar:/export/home/s
mayhew/condor/tools/ant/lib/optional.jar:/export/home/smayhew/condor/tools/ant/l
ib/junit.jar:/export/home/smayhew/condor/tools/ant/lib/js.jar:/export/home/smayh
ew/condor/tools/ant/lib/jaxp.jar:/export/home/smayhew/condor/tools/ant/lib/jakar
ta-regexp-
1.2.jar:/export/home/smayhew/condor/tools/ant/lib/bsf.jar:/export/home/smayhew/c
ondor/tools/ant/lib/ant.jar:/u02/app/bea/jdk130/lib/tools.jar
initializeClass: class com.valdero.ant.taskdefs.CastorSrcGen
initializeClass: class com.valdero.ant.taskdefs.CastorSrcGen  throws: 
java.lang.IllegalArgumentException: wrong number of arguments
  [taskdef] taskDef Loaded class class com.valdero.ant.taskdefs.Xmlc, 
AntClassLoader with 
classpath: /export/home/smayhew/condor/tools/antTasks/anttasks.jar:/export/home/
smayhew/condor/external/lib/xmlc.jar:/export/home/smayhew/condor/external/lib/gn
u-regexp.jar:/export/home/smayhew/condor/external/lib/jtidy-
xmlc.jar:/export/home/smayhew/condor/external/lib/xerces-
xmlc.jar:/export/home/smayhew/condor/external/lib/castor.jar:/export/home/smayhe
w/condor/tools/ant/lib/xml-
apis.jar:/export/home/smayhew/condor/tools/ant/lib/xercesImpl.jar:/export/home/s
mayhew/condor/tools/ant/lib/optional.jar:/export/home/smayhew/condor/tools/ant/l
ib/junit.jar:/export/home/smayhew/condor/tools/ant/lib/js.jar:/export/home/smayh
ew/condor/tools/ant/lib/jaxp.jar:/export/home/smayhew/condor/tools/ant/lib/jakar
ta-regexp-
1.2.jar:/export/home/smayhew/condor/tools/ant/lib/bsf.jar:/export/home/smayhew/c
ondor/tools/ant/lib/ant.jar:/u02/app/bea/jdk130/lib/tools.jar
initializeClass: class com.valdero.ant.taskdefs.Xmlc
  [taskdef] NoClassDefFoundError, AntClassLoader with 
classpath: /export/home/smayhew/condor/tools/antTasks/anttasks.jar:/export/home/
smayhew/condor/external/lib/xmlc.jar:/export/home/smayhew/condor/external/lib/gn
u-regexp.jar:/export/home/smayhew/condor/external/lib/jtidy-
xmlc.jar:/export/home/smayhew/condor/external/lib/xerces-xmlc.jar

BUILD FAILED
file:/export/home/smayhew/condor/module/ui/build.xml:22: taskdef class 
com.valdero.ant.taskdefs.Xmlc cannot be found
        at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:251)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162)
        at org.apache.tools.ant.helper.ProjectHelperImpl$TaskHandler.finished
(ProjectHelperImpl.java:821)
        at 
org.apache.tools.ant.helper.ProjectHelperImpl$AbstractHandler.endElement
(ProjectHelperImpl.java:300)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement
(AbstractSAXParser.java:572)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement
(AbstractXMLDocumentParser.java:218)
        at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement
(XMLNamespaceBinder.java:594)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement
(XMLDTDValidator.java:777)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement
(XMLDocumentFragmentScannerImpl.java:748)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
dispatch(XMLDocumentFragmentScannerImpl.java:1453)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(XMLDocumentFragmentScannerImpl.java:333)
        at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:524)
        at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:580)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse
(AbstractSAXParser.java:1169)
        at org.apache.tools.ant.helper.ProjectHelperImpl.parse
(ProjectHelperImpl.java:155)
        at org.apache.tools.ant.ProjectHelper.configureProject
(ProjectHelper.java:117)
        at org.apache.tools.ant.Main.runBuild(Main.java:597)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/enhydra/xml/xmlc/XMLCException
        at java.lang.Class.getConstructors0(Native Method)
        at java.lang.Class.getDeclaredConstructors(Class.java:1077)
        at org.apache.tools.ant.AntClassLoader.initializeClass
(AntClassLoader.java:483)
        at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:236)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162)
        at org.apache.tools.ant.helper.ProjectHelperImpl$TaskHandler.finished
(ProjectHelperImpl.java:821)
        at 
org.apache.tools.ant.helper.ProjectHelperImpl$AbstractHandler.endElement
(ProjectHelperImpl.java:300)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement
(AbstractSAXParser.java:572)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement
(AbstractXMLDocumentParser.java:218)
        at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement
(XMLNamespaceBinder.java:594)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement
(XMLDTDValidator.java:777)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement
(XMLDocumentFragmentScannerImpl.java:748)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
dispatch(XMLDocumentFragmentScannerImpl.java:1453)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(XMLDocumentFragmentScannerImpl.java:333)
        at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:524)
        at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:580)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse
(AbstractSAXParser.java:1169)
        at org.apache.tools.ant.helper.ProjectHelperImpl.parse
(ProjectHelperImpl.java:155)
        at org.apache.tools.ant.ProjectHelper.configureProject
(ProjectHelper.java:117)
        at org.apache.tools.ant.Main.runBuild(Main.java:597)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 3 seconds

And the source for the anttask:
/*
 * Enhydra Java Application Server Project
 * 
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 * the License for the specific terms governing rights and limitations
 * under the License.
 * 
 * The Initial Developer of the Enhydra Application Server is Lutris
 * Technologies, Inc. The Enhydra Application Server and portions created
 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
 * All Rights Reserved.
 * 
 * Contributor(s):
 * 
 * $Id: XMLC.java,v 1.23 2001/12/06 08:33:11 paul Exp $
 */

package org.enhydra.xml.xmlc.commands.xmlc;

import org.enhydra.xml.xmlc.*;
import org.enhydra.xml.xmlc.compiler.Compiler;
import org.enhydra.xml.xmlc.commands.ErrorHandling;
import org.enhydra.xml.xmlc.commands.options.*;
import org.enhydra.xml.xmlc.metadata.*;
import org.enhydra.xml.io.ErrorReporter;
import java.io.PrintWriter;
import java.io.IOException;

/**
 * XMLC compiler program.  See the user manual for details on the command
 * line.  Will look for a system property `org.enhydra.xml.xmlc.javac' to find
 * the compiler to use if -javac is not specified.
 */
public class XMLC {
    /**
     * System property to pass default javac.
     */
    public static final String JAVAC_PROPERTY = "org.enhydra.xml.xmlc.javac";

    /**
     * Command line parsing object.
     */
    private XMLCOptionsParser fOptionsParser = new XMLCOptionsParser();

    /**
     * Enable verbose output.
     */
    private boolean fVerbose = false;

    /*
     * Stream to use for stdout.
     */
    private PrintWriter fStdout;

    /*
     * Error output.
     */
    private ErrorReporter fErrorReporter;

    /*
     * Trace and verbose output.
     */
    private PrintWriter fTraceOut;

    /**
     * Constructor specifying output stream for error messages.
     */
    public XMLC(PrintWriter stdout,
                PrintWriter stderr) {
        fStdout = stdout;
        fErrorReporter = new ErrorReporter(stderr);
        fTraceOut = stderr;
    }

    /**
     * Constructor with standard output streams.
     */
    public XMLC() {
        this(new PrintWriter(System.out, true),
             new PrintWriter(System.err, true));
    }

    /*
     * Print the XMLC version number.
     */
    private void printVersion() {
        fStdout.println("Enhydra XMLC version " + XMLCVersion.VERSION);
        fStdout.println("See http://xmlc.enhydra.org for latest distribution");
    }

    /**
     * Parse arguments.
     */
    private MetaData parseArgs(String[] args) throws XMLCException, IOException 
{
        MetaData metaData = fOptionsParser.parse(args, fErrorReporter);
        
        // Default javac if supplied by a property.
        String defaultJavac = System.getProperty(JAVAC_PROPERTY);
        if (defaultJavac != null) {
            JavaCompilerSection compilerSection = 
metaData.getJavaCompilerSection();
            if (!compilerSection.isJavacSpecified()) {
                compilerSection.setJavac(defaultJavac);
            }
        }
        return metaData;
    }

    /**
     * Parse arguments and compile the page.  If this method is used,
     * errors are thrown, exit will not be called.
     */
    public void compile(String[] args) throws XMLCException, IOException {
        
        // Setup and document parsing.
        MetaData metaData = parseArgs(args);
        CompileOptions compileOptions = metaData.getCompileOptions();
        fVerbose = compileOptions.getVerbose();

        if (compileOptions.getPrintVersion()) {
            printVersion();
        }

        if (metaData.getInputDocument().getUrl() != null) {
            Compiler compiler = new Compiler(fErrorReporter,
                                             fTraceOut);
            compiler.compile(metaData);
        }
    }

    /*
     * Parse arguments and compile the page.  Print errors that
     * are thrown.
     */
    private void compileHandleErrors(String[] args) {
        try {
            compile(args);
        } catch (Exception except) {
            ErrorHandling.handleException(except, fVerbose);
        }
    }

    /*
     * Program entry point.
     */
    public static void main(String[] args) {
        XMLC xmlc = new XMLC();
        xmlc.compileHandleErrors(args);
    }
}

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message