users@jaxb.java.net

RE: Still frustrated with ClassDefNotFoundError for com/sun/xml/bind/v2/runtime/JAXBContextImpl$JAXBContextBuilder with xjc in Ant

From: KARR, DAVID (ATTSI) <"KARR,>
Date: Tue, 9 Feb 2010 10:57:19 -0800

> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Tuesday, February 09, 2010 10:37 AM
> To: users_at_jaxb.dev.java.net
> Subject: Still frustrated with ClassDefNotFoundError for
> com/sun/xml/bind/v2/runtime/JAXBContextImpl$JAXBContextBuilder with
xjc
> in Ant
>
> I thought I'd gotten past my classpath problems with XJC in Ant, but I
> was mistaken. I had gotten a build to work with it, but it was sort
of
> an accident. My classpath settings were specifying the path to the
> "xjc" jar, but I was actually referencing a nonexistent path, so it
> appears it was getting "com.sun.tools.xjc.XJCTask" from the JRE. When
> I
> tried changing the classpath settings so it did include my copy of
> "jaxb-xjc-2.1.12.jar", then it gets the "
> java.lang.NoClassDefFoundError:
> com/sun/xml/bind/v2/runtime/JAXBContextImpl$JAXBContextBuilder" error.
>
> In addition, I'm now trying to set up xjc in a different project,
using
> the same jvm and same jaxb jars. This "trick" of not specifying the
> path to the xjc jar doesn't work in this project. It simply says it
> can't find the task class.
>
> I also tried adding "-verbose" to the Ant command line, which did give
> me a bit of useful information. When I do this in the project that
> currently works (because I'm not specifying the path to the xjc jar),
I
> get this line in the output:
>
> build id of XJC is hudson-jaxb-ri-2.1-257
>
> When I "fix" the classpath so it references my "xjc" jar, I get this:
>
> build id of XJC is hudson-jaxb-ri-2.1-833
>
> And then it gets the NCDNFE.
>
> The new project is getting the latter value, and the NCDNFE. When I
> simply don't specify the path to the "xjc" jar, it gets an ordinary
CNF
> error, saying it can't find the task class.
>
> Where do I get the exact jars that I need to use with JDK 1.5? This
> seems like it should be simple, but apparently it is not.

Hmm, when I turned on verbose class loading in ANT_OPTS, I discovered
that it's getting the jaxb classes from the Ant 1.7.1 "ant.jar". That's
obviously an important clue, but I don't know what to do with that yet.