users@jersey.java.net

[Jersey] ContextResolver , JSON and ERROR_JAXB_RI_2_1_10_MISSING()

From: Cemo Koc <cem.koc.fwd_at_gmail.com>
Date: Fri, 16 Oct 2009 03:55:21 -0700 (PDT)

Hi,

I have a little problem in my logs.

I encountered this exception:

The provider class, class com.xxx.providers.JAXBEntityContextResolver, could
not be instantiated. Processing will continue but the class will not be
utilized
java.lang.RuntimeException: [failed to localize]
error.jaxb.ri.2.1.10.missing()

I checked my jars

jaxb-impl-2.1.10.jar
jaxb-api-2.1.jar


Then I checked JSONConfiguration class

public static Builder natural() {
        // this is to make sure people trying to use NATURAL notation will
get clear message what is missing, when an old JAXB RI version is used
        try {
           
Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
        } catch (ClassNotFoundException ex) {
           
Logger.getLogger(JSONConfiguration.class.getName()).log(Level.SEVERE,
ImplMessages.ERROR_JAXB_RI_2_1_10_MISSING());
            throw new
RuntimeException(ImplMessages.ERROR_JAXB_RI_2_1_10_MISSING());
        }
        return new Builder(Notation.NATURAL);
    }


I do not know why it is happening.

This is also my context resolver:


@Provider
@Produces(MediaType.APPLICATION_JSON)
public class JAXBEntityContextResolver implements
ContextResolver<JAXBContext> {

    private JAXBContext context;

    public JAXBEntityContextResolver() throws Exception {

        AnnotatedClassScanner classScanner = new AnnotatedClassScanner(
XmlType.class,XmlRootElement.class);
        Set<Class<?>> classes = classScanner.scan(new
String[]{"com.yyy.entities","com.xxx.bean"});
        this.context = new
JSONJAXBContext(JSONConfiguration.natural().build(), classes.toArray(new
Class[classes.size()]));
    }

    public JAXBContext getContext(Class<?> objectType) {
        return context;
    }
}

I have not expected this exception in my logs.

Any idea about this?

Thanks

-- 
View this message in context: http://n2.nabble.com/ContextResolver-JSON-and-ERROR-JAXB-RI-2-1-10-MISSING-tp3834876p3834876.html
Sent from the Jersey mailing list archive at Nabble.com.