users@jersey.java.net

Jersey Class Not Found Exception

From: jimz <jzombek_at_bericotechnologies.com>
Date: Fri, 19 Nov 2010 08:30:07 -0800 (PST)

I am trying to marshall an JAXB annotated POJO to JSON using Jersey 1.4. See
code snipplet below:

Class[] classesToBeBound = {myPOJO.class};

JSONJAXBContext context = new
JSONJAXBContext(JSONConfiguration.natural().build(),classesToBeBound);
JSONMarshaller marshaller = context.createJSONMarshaller();
marshaller.marshal(myPOJO, System.out );

The application compiles using Java 1.6, however I get the following runtime
error when I run the program.

javax.servlet.ServletException:
com.sun.jersey.api.container.MappableContainerException:
java.lang.NoSuchMethodError:
com.sun.jersey.api.json.JSONConfiguration.natural()Lcom/sun/jersey/api/json/JSONConfiguration$NaturalBuilder;

My maven POM includes the following:

<dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>2.5</version>
        </dependency>
        <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-server</artifactId>
      <version>1.4</version>
    </dependency>
   <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-json</artifactId>
      <version>1.4</version>
    </dependency>

Can anyone provide some assistance? Thanks.

-- 
View this message in context: http://jersey.576304.n2.nabble.com/Jersey-Class-Not-Found-Exception-tp5755677p5755677.html
Sent from the Jersey mailing list archive at Nabble.com.