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: Wed, 10 Feb 2010 07:04:50 -0800

Even stranger. Here's a line of output after I turned on
"-verbose:class":

 

[Loaded javax.xml.bind.JAXB from file:/c:/apache-ant-1.7.1/lib/ant.jar]

 

However, I can clearly see this class is not in that jar. I thought
perhaps the jar had a classpath property in the manifest, but it
doesn't.

 

From: Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
Sent: Wednesday, February 10, 2010 12:30 AM
To: users_at_jaxb.dev.java.net
Subject: Re: Still frustrated with ClassDefNotFoundError for
com/sun/xml/bind/v2/runtime/JAXBContextImpl$JAXBContextBuilder with xjc
in Ant

 

What you report is very strange. In /usr/share/ant/lib/ of Apache Ant
version 1.7.1 compiled on November 10 2008 I have 26 jars files, but non
of them contains a class with JAXB (in any case) in its name. Bundling
JAXB with ant wouldn't make sense at all. The JAXB samples for running
xjc with ant all contain settings for some specific JAXB jar set.

-W

On Tue, Feb 9, 2010 at 7:57 PM, KARR, DAVID (ATTSI) <dk068x_at_att.com>
wrote:

> -----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.


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