JAXB in jdk 1.6

796 views
Skip to first unread message

Travis

unread,
May 22, 2007, 6:22:32 PM5/22/07
to typica
Hi,

So I'm trying to use the JAXB included in 1.6, but I get this error:

Caused by: javax.xml.bind.JAXBException: Provider
com.sun.xml.bind.v2.ContextFactory not found
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:151)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:298)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at com.xerox.amazonws.common.JAXBuddy.getUnmarshaller(JAXBuddy.java:
63)
at
com.xerox.amazonws.common.JAXBuddy.deserializeXMLStream(JAXBuddy.java:
49)
at
com.xerox.amazonws.sqs.QueueService.listMessageQueues(QueueService.java:
147)

Doesn't really make sense why since supposedly it should cleanly
upgrade unless there's some JAXB specific code in Typica, but I'm not
seeing it in JAXBuddy.java.

Any ideas?

Travis

unread,
May 22, 2007, 6:41:20 PM5/22/07
to typica
My bad, had an old jaxb-api.jar in my libs/endorsed directory.
Removed that and it works fine again.

dkav...@gmail.com

unread,
May 22, 2007, 7:01:35 PM5/22/07
to typica
cool. I'm glad you found the problem. For the record, I grabbed the
latest release of JAXB this past winter and have been using that with
JDK 1.5. I'm glad to hear typica works fine in jdk1.6.

David

Message has been deleted

xnixnix

unread,
Jun 12, 2007, 8:38:33 PM6/12/07
to typica
Just for the record,

typica works great with jdk1.6 but when compiling with that
version I got this error:

BUILD FAILED
/home/mo/typicasvn/build.xml:43: java.lang.LinkageError: JAXB 2.0 API
is being loaded from the bootstrap classloader, but this RI (from
jar:file:/home/mo/typicasvn/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/
model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed
directory mechanism to place jaxb-api.jar in the bootstrap
classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)

I didn´t want to fuzz around with endorsed.dirs etc. so I compiled
with jdk1.5 - worked fine

dkav...@gmail.com

unread,
Jun 13, 2007, 1:08:45 AM6/13/07
to typica
I was just reading this over;
https://jaxb.dev.java.net/guide/Migrating_JAXB_2_0_applications_to_JavaSE_6.html

It looks like JavaSE 6 uses a version of JAXB that is very close to
the 2.0 version that I've been using. I need to download JavaSE 6 and
do some testing.

David

On Jun 12, 8:38 pm, xnixnix <xnix...@gmail.com> wrote:
> Just for the record,
>
> typica works great with jdk1.6 but when compiling with that
> version I got this error:
>
> BUILD FAILED
> /home/mo/typicasvn/build.xml:43: java.lang.LinkageError: JAXB 2.0 API
> is being loaded from the bootstrap classloader, but this RI (from
> jar:file:/home/mo/typicasvn/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/
> model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed
> directory mechanism to place jaxb-api.jar in the bootstrap

> classloader. (Seehttp://java.sun.com/j2se/1.5.0/docs/guide/standards/)

Travis Reeder

unread,
Jun 13, 2007, 1:40:48 AM6/13/07
to typ...@googlegroups.com
I had the same problem as xnixnix when trying to build the project with 1.6, and I tried putting the jaxb-api.jar in the jdk endorsed directory which helps getting it to build. But that caused other problems (can't remember what, I believe a different project??) so I had to remove the jar from the endorsed dir (lost a lot of hair that day trying to figure out that problem)... but then I couldn't build Typica again. So I started playing with the jars in /lib and deleted the jaxb ones, but then you get this problem:

...\build.xml:22: taskdef class com.sun.tools.xjc.XJCTask cannot be found

It appears that this task isn't in the JDK 1.6 jaxb. Definitely some chicken and egg problems going on...

Travis

> > > >         at javax.xml.bind.JAXBContext.newInstance (JAXBContext.java:337)

dkav...@gmail.com

unread,
Jun 18, 2007, 2:37:04 PM6/18/07
to typica
As Travis found out, typica runs fine with JavaSE 6. I've confirmed
that.
Building it is an issue. I'm trying to figure that out. I'll post back
here once I figure it out.

David

On Jun 13, 1:40 am, "Travis Reeder" <tree...@gmail.com> wrote:
> I had the same problem as xnixnix when trying to build the project with 1.6,
> and I tried putting the jaxb-api.jar in the jdk endorsed directory which
> helps getting it to build. But that caused other problems (can't remember
> what, I believe a different project??) so I had to remove the jar from the
> endorsed dir (lost a lot of hair that day trying to figure out that
> problem)... but then I couldn't build Typica again. So I started playing
> with the jars in /lib and deleted the jaxb ones, but then you get this
> problem:
>
> ...\build.xml:22: taskdef class com.sun.tools.xjc.XJCTask cannot be found
>
> It appears that this task isn't in the JDK 1.6 jaxb. Definitely some chicken
> and egg problems going on...
>
> Travis
>

> On 6/12/07, dkavan...@gmail.com <dkavan...@gmail.com> wrote:
>
>
>
> > I was just reading this over;
>

> >https://jaxb.dev.java.net/guide/Migrating_JAXB_2_0_applications_to_Ja...

dkav...@gmail.com

unread,
Jun 19, 2007, 1:38:38 PM6/19/07
to typica
I've learned something else. I downloaded the JWSDP 2.0 (http://
java.sun.com/webservices/downloads/previous/webservicespack.jsp)
and used the jaxb files from it. I put the impl and api jars in the
jdk1.6/jre/lib/endorsed directory and put jaxb-xjc.jar in the typica/
lib dir. I removed the other jaxb jars from the tyipca/lib dir. I can
almost compile typica. There are two compile errors in MessageQueue
that relate to different code that JAXB generated.

David

dkav...@gmail.com

unread,
Jun 19, 2007, 2:14:38 PM6/19/07
to typica
OK, I got things compiling in JavaSE 6.
Download JAXB 2.1.3,
- remove all but the commons-logging.jar from the typica lib dir
- put the jaxb-xjc.jar in the typica lib dir
- put the activation.jar, jaxb-api.jar, jaxb-impl.jar and
jsr173_1.0_api.jar into the jdk1.6/jre/lib/endorsed directory
that's it, you're good to go.
If anyone has an idea of how to make this less painful, please let me
know.

David

Travis Reeder

unread,
Jun 19, 2007, 2:24:07 PM6/19/07
to typ...@googlegroups.com
What is JAXB used for anyways? Maybe you could just replace it with a simpler solution like XStream: http://xstream.codehaus.org/

Travis

On 6/19/07, dkav...@gmail.com <dkav...@gmail.com> wrote:

OK, I got things compiling in JavaSE 6.
Download JAXB 2.1.3,
- remove all but the commons-logging.jar from the typica lib dir
- put the jaxb-xjc.jar in the typica lib dir
- put the activation.jar, jaxb-api.jar , jaxb-impl.jar and

dkav...@gmail.com

unread,
Jun 19, 2007, 2:35:06 PM6/19/07
to typica
Hmm, I guess by moving to something not likely to be added to the JDK
rt.jar, we avoid the problems we saw with JAXB and jdk1.6. Still, not
sure it is worth the switch. To answer your question, I use JAXB to
deserialize the XML response from the WS calls. The build generates
classes based on the schema for each web service (which is provided by
Amazon). I think JAXB does a pretty good job and the code it generates
is something I can live with. I've used XMLBeans and wasn't too happy
with the usability of the generated code in certain cases. I
understand that XStream is something entirely different. I'd end up
having to write a bunch of classes that JAXB does for me.

It seems like JAXB was just becoming a pain for those who build the
library out of subversion. Why do people need to do that? Is there
something you are adding? Is there anything that I can add to typica
to avoid that? Are the releases frequent enough?

David

On Jun 19, 2:24 pm, "Travis Reeder" <tree...@gmail.com> wrote:
> What is JAXB used for anyways? Maybe you could just replace it with a
> simpler solution like XStream:http://xstream.codehaus.org/
>
> Travis
>

> On 6/19/07, dkavan...@gmail.com <dkavan...@gmail.com> wrote:
>
>
>
> > OK, I got things compiling in JavaSE 6.
> > Download JAXB 2.1.3,
> > - remove all but the commons-logging.jar from the typica lib dir
> > - put the jaxb-xjc.jar in the typica lib dir

> > - put the activation.jar, jaxb-api.jar, jaxb-impl.jar and

Travis Reeder

unread,
Jun 19, 2007, 2:48:13 PM6/19/07
to typ...@googlegroups.com
On 6/19/07, dkav...@gmail.com <dkav...@gmail.com> wrote:

It seems like JAXB was just becoming a pain for those who build the
library out of subversion. Why do people need to do that? Is there
something you are adding? Is there anything that I can add to typica
to avoid that? Are the releases frequent enough?

Good point, perhaps it's not a big deal if you are quick to fix. Might as well push out the new release like you mentioned in the other thread. Thanks for looking into it though.

David

On Jun 19, 2:24 pm, "Travis Reeder" < tree...@gmail.com> wrote:
> What is JAXB used for anyways? Maybe you could just replace it with a
> simpler solution like XStream:http://xstream.codehaus.org/
>
> Travis
>
> On 6/19/07, dkavan...@gmail.com <dkavan...@gmail.com> wrote:
>
>
>
> > OK, I got things compiling in JavaSE 6.
> > Download JAXB 2.1.3,
> > - remove all but the commons-logging.jar from the typica lib dir
> > - put the jaxb-xjc.jar in the typica lib dir
> > - put the activation.jar, jaxb-api.jar , jaxb-impl.jar and

David Kavanagh

unread,
Jun 19, 2007, 2:51:53 PM6/19/07
to typ...@googlegroups.com
Done!
Reply all
Reply to author
Forward
0 new messages