users@jersey.java.net

Re: [Jersey] [JSON]JAXBContextResolver met with VerifyError in JBoss-4.x-jdk6

From: William <zhou_william_at_yahoo.cn>
Date: Tue, 12 May 2009 10:46:25 +0800 (CST)

Hi Chris & Paul,

Thanks for the quick response. As you advised, the conflict exists in jaxb-api.jar. The problem has been resloved. Thanks!

William

On May 11, 2009, at 1:54 PM, Chris Winters wrote:

I think you need to use JAXB 2.1.10, and if you use JDK 6 you need to put the relevant JARs in an 'endorsed' directory.

Correct.

Paul.

Chris

On May 11, 2009 4:26 AM, "William" <zhou..._at_yahoo.cn> wrote:

Hi,

When I upgraded the deployment of my Jersey application from JBOSS 4.2.3.GA (env:JDK5) to JBOSS 4.2.3.GA-jdk6 (env:JDK6), I met an error. The issue was in JAXBContextResolver, my class is:

@Provider public class JAXBContextResolver implements ContextResolver<JAXBContext> { public JAXBContextResolver() throws Exception { this.m_context = new JSONJAXBContext(JSONConfiguration.natural().build(), m_types); }

public JAXBContext getContext(Class<?> objectType) { return (m_types[0].equals(objectType)) ? m_context : null; }

private JAXBContext m_context; private final Class[] m_types = {my.example.Representation.class}; }

1) I have configured my application.xml, including the providers; 2) I used different JDK env for different versions of JBoss.

Error message in JBoss console was:

INFO: Scanning for root resource and provider classes in the packages: my.example.resource my.example.provider my.example.provider.exception 02:33:21,297 ERROR [STDERR] May 11, 2009 2:33:21 AM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Root resource classes found: class my.example.resource.ServiceResource 02:33:21,297 ERROR [STDERR] May 11, 2009 2:33:21 AM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Provider classes found: class my.example.provider.JAXBContextResolver class my.example.provider.JAXBMarshallerResolver class my.example.provider.ContentStreamingOutputProvider class my.example.provider.DomDocumentWriterProvider class my.example.provider.exception.DefaultExceptionMapper 02:33:21,407 ERROR [[/resources]] StandardWrapper.Throwable java.lang.VerifyError: (class: my/example/provider/ JAXBContextResolver, method: <init> signature: ()V) Bad type in putfield/putstatic at java.lang.Class.getDeclaredMethods0(Native Method)
 at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.privateGetPublicMethods(Unknown Source) at java.lang.Class.getMethods(Unknown Source)