users@jersey.java.net

[Jersey] Re: How to run Jersey 2.0

From: Martin Matula <martin.matula_at_oracle.com>
Date: Mon, 11 Jun 2012 15:18:52 +0200

Hi,
You should not need the grizzly jars. Running on Jetty/Tomcat should be straightforward - just deploy the war and you should be good to go. With GF the situation is a bit more complicated, since GF bundles and older version of Jersey and there is a clash (unfortunately GF does not allow us to load javax.ws.rs.* classes using a separate classloader by default). To work around it, you can try following the same thing we have been advising users for running newer versions of 1.x on GF:
1) set the override packages property in GF
2) turn off classloader delegation in the deployment descriptor in your war
See http://jersey.java.net/nonav/documentation/1.12/glassfish.html#d4e1903
Regards,
Martin


On Jun 7, 2012, at 1:09 AM, agksmehx_at_gmail.com wrote:

> I built the simplest Jersey 2.0 application into a .war file using
> maven. I had dependencies on jersey-server, jersey-client,
> jersey-common for version 2.0-m04 which causes the .war file to contain
> within WEB-INF/lib the jars listed below. I tried deploying it in
> Glassfish 3.1.2 but it didn't work. (javax.servlet.ServletException:
> PWC1391: Servlet.init() for servlet com.younum.web.www.rs.RS threw
> exception) root cause:
> com.sun.jersey.spi.inject.Errors$ErrorMessagesException
>
> I am omitting details of the error because I am doing something higher
> level that's not right.
>
> Could somebody please give me newbie-level instructions on how to run
> Jersey 2.0? I can use maven only at an elementary level (compile,
> install java / war projects).
>
> My guess is that I cannot use Glassfish 3.1.2. The central question is
> -- given a web server such as Jetty or a Java EE server such as
> Glassfish, how to modify it to run Jersey 2.0?
>
> jars included in WEB-INF/lib:
>
> activation-1.1.jar
> asm-all-repackaged-2.0.3.jar
> auto-depends-2.0.3.jar
> gmbal-api-only-3.0.0-b023.jar
> grizzly-framework-2.2.7.jar
> grizzly-http-2.2.7.jar
> grizzly-http-server-2.2.7.jar
> grizzly-rcm-2.2.7.jar
> guava-osgi-11.0.1.jar
> hk2-api-2.0.3.jar
> javax.inject-1.jar
> javax.inject-2.0.3.jar
> javax.ws.rs-api-2.0-m05.jar
> jersey-client-2.0-m04.jar
> jersey-common-2.0-m04.jar
> jersey-container-grizzly2-http-2.0-m04.jar
> jersey-server-2.0-m04.jar
> mail-1.4.jar
> management-api-3.0.0-b012.jar
> osgi-resource-locator-1.0.1.jar
> tiger-types-1.4.jar