users@jaxb.java.net

Problem with Ant task

From: Filip Rindler <filip.rindler_at_gmx.de>
Date: Sat, 21 Jun 2003 11:55:07 +0200

Hi!

I'm just starting with Ant and when trying to use the XJC Ant task in my
build file i always get the following error:

[xjc] Compiling
file:/D:/Projekte/Cytorit/Code/Framework/${xmldir}/mtxfile.xsd
BUILD FAILED: java.lang.IllegalAccessError: tried to access method
org.apache.xerces.util.ObjectFactory.newInstance(Ljava/lang/String;Ljava/lan
g/ClassLoader;Z)Ljava/lang/Object; from class
org.apache.xerces.parsers.XMLGrammarPreparser

Here's how i defined the XJC task in my build.xml:

<property name="jwsdp.dir" value="C:\Java\jwsdp-1.2" />
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
    <classpath>
        <fileset dir="${jwsdp.dir}/jaxb/lib" includes="*.jar"
excludes="ant.jar"/>
        <fileset dir="${jwsdp.dir}">
            <include name="jaxp/**/*.jar"/>
            <include name="jwsdp-shared/lib/**/*.jar"/>
        </fileset>
    </classpath>
</taskdef>


And here's my compile target:

<!-- Compile target -->
<target name="compile" depends="init">
    <!-- compile schema -->
    <echo message="Compiling the schema..."/>
    <xjc schema="${xmldir}/mtxfile.xsd" target="${gensrc.dir}"
readonly="true"/>

    <!-- compile -->
    <echo message="Compiling..."/>
    <javac srcdir="${src.dir}" destdir="${dest.dir}" />
    <javac srcdir="${gensrc.dir}" destdir="${dest.dir}" />
</target>

I don't have a clue what I'm doing wrong, so I would appreciate your help!

Thanks in advance!

Fil Rindler