Guillaume Berche wrote:
> 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,
Thank you very much for sharing this. To add to your note, if you run
ant with the -verbose option, XJC should tell you where you are loading
Xerces from, and the version of that Xerces. That might help you
trouble-shoot the problem.
When we've been developing JAXB RI, we've used standard Apache Ant 1.5.3
with XJCTask without using any ANT_OPTS and it just worked fine.
I'm not totally sure, but I thought if your <taskdef> includes Xerces
that XJC needs, then that would work fine.
In 2.0, we'll be removing this ugly dependency to a particular version
of Xerces, so hopefully our users won't have to suffer a problem like this.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net