users@jaxb.java.net

How to use XJC with standard ANT distribution and without JWSDP_HOME

From: Guillaume Berche <guillaume.berche_at_eloquant.com>
Date: Wed, 15 Dec 2004 17:55:33 +0100

Hello,

I've struggled for a while to manage to use the XJC compiler and the runtime
without the full jwsdp version 1.5. I finally managed to get it working, and
hope this email might help others running through the same problems.

I'm was trying to use JAXB's XJC ANT task with the standard distribution
that my project uses: ant 1.6.2

The first step was to download and install jwsdp-1.5. I was able to properly
run the XJC ANT task with the bundled ant version.

Then, I was trying to integrate JAXB RI 1.0.4 into my standard ANT build
process, and I was running into problems when using JDK 1.4.2. I've had
tried to follow the JAXB ANT task documentation and separate the
compilation, and runtime classpath.
I'd therefore added the jars that are described as being required in
jwsdp-1.5\jaxb\docs\ReleaseNotes.html


However, when running with JDK 1.4.2, I was getting the following error:

--------------------------
AIX:/users/latestBuild/Misc/foo>ant clean compile
Buildfile: build.xml

clean:
   [delete] Deleting directory C:\users\latestBuild\Misc\foo\gen-src

compile:
     [echo] Compiling the schema...
    [mkdir] Created dir: C:\users\latestBuild\Misc\foo\gen-src
      [xjc] Compiling
file:/C:/users/latestBuild/Misc/foo/conf/schema/intelligent-network-link.xsd
      [xjc] [WARNING] Unable to validate your schema. Most likely, the
JVM has loaded an incompatible XML parser implementation. You should fix
this before relying on the generated code. Please see the release
notes for details.
      [xjc] unknown location


BUILD FAILED
java.lang.NoClassDefFoundError:
com/sun/org/apache/xml/internal/serialize/Output
Format

Total time: 6 seconds
--------------------------

I checked the version of xercesImpl.jar used in both ant 1.6.2 and
jwsdp-1.5\jaxp\lib\endorsed: they happen to be the same version: Xerces J
2.6.2.

However, when I run the same compilation with JDK 1.5.0, I get no error. I
suspect that JDK 1.4.2 has an incompatible version of xerces embedded that
JDK 1.5.0 does not.

I solved the problem my telling ANT to ask the JVM to use the specified libs
as an overide of its builtin libs:
export ANT_OPTS="-Djava.endorsed.dirs=./lib/jaxp/endorsed"

This solved the problem: now I can properly execute XJC without the JWSDP
and with a standard unmodified ANT 1.6.2 distribution.

I hope this can help,

Best regards,

Guillaume.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net