users@jaxb.java.net

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:37:13 -0800

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.