users@jersey.java.net

[Jersey] Re: Exception during Json Return Object

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Fri, 14 Jan 2011 09:55:06 -0800

On Thu, Jan 13, 2011 at 3:09 PM, johny0704 <johnyse81_at_gmail.com> wrote:
>
> Hi, I have create simple Json example and getting the below error, can you
> plz any one help me
...
> 7:42:39,122 ERROR [ContainerBase] Servlet.service() for servlet JAX-RS REST
> Servlet threw exception
> ava.lang.LinkageError: loader constraints violated when linking
> javax/xml/stream/XMLStreamWriter class

Did you check out javadocs for LinkageError? It says:

"Subclasses of LinkageError indicate that a class has some dependency
on another class; however, the latter class has incompatibly changed
after the compilation of the former class. "

So it sounds like version of XMLStreamWriter (which is part of Stax
API, added in JDK 1.6; also available as stand-alone jar for 1.5) that
was used to compile Jersey is different from one being deployed. If
you run on JDK 1.6 you can probably just remove stax-api jar, wherever
it is.

-+ Tatu +-