Monthly Archives: June 2013

I’m very excited to announce that after 2+ years of prototyping, refactoring and development we have released the final version of both JAX-RS 2.0 API and Jersey 2.0 which provides Reference Implementation for JAX-RS 2.0.

Those of you, who followed my earlier updates know, that Jersey 2.0 has been heavily refactored to accomodate significant changes brought by JAX-RS 2.0, such as Client API, Filters and interceptors or Server-side async support. We have also decided to switch to git as our primary VCS which allowed us to move the project repository to GitHub. We hope that this move will make it easier for our community to browse through the code and contribute to the project via convenient pull requests.

Jersey 2.0 provides support for Java SE HTTP Server, Grizzly 2 HTTP server, Servlet 2.5 or higher containers as well as OSGi containers on the server side and HTTPURLConnection-based or Grizzly asynchronous client transport connectors. To leverage JAX-RS/Jersey server-side async features in a Servlet container, you need a container that supports Servlet 3.0 at least. Jersey supports asynchronous resource invocations on Grizzly 2 HTTP server too.

If you are interested in more details about the work done as part of Jersey 2.0 release, check out the Jersey 2.0 Release Notes.

Where to get?

All the Jersey 2.0 release binaries, including the source & apidocs jars, are available for download under the Jersey 2.0 maven root group identifier org.glassfish.jersey from the central maven repository as well as from the java.net maven repository.

To start with Jersey 2.0, downloading Jersey JAX-RS 2.0 RI bundle is a good start as the bundle contains the JAX-RS 2.0 API jar, all the core Jersey module jars as well as all the required 3rd-party dependencies. You may also want to download Jersey 2.0 Examples bundle for off-line browsing.

Chances are you are using Apache Maven as a build & dependency management tool for your project. If you do, there is a very easy and convenient way to start playing with Jersey 2.0 by generating the skeleton application from one of the Jersey 2.0 maven archetypes that we provide. For instance, to create a Jersey 2.0 application using the Grizzly 2 HTTP server container, use

What about Java EE 7?

As most of you have probably noticed, Java EE 7 platform has been released too. JAX-RS 2.0 is included in this enterprise Java platform release and as such Jersey 2.0 is included in Java EE 7 RI that is provided by GlassFish 4.0. This means that you can deploy your JAX-RS 2.0 applications to GlassFish 4.0 without having to worry about Jersey 2.0 dependencies.

Important note on Jersey 2.0 in GlassFish 4.0!

Unfortunately, in case you are playing with the GlassFish 4.0 release (build 4.0-b89) there is a task you may want to do in order to get the released Jersey 2.0 version installed in your GlassFish instance. The version of Jersey 2.0 bundled with the released GlassFish 4.0 (4.0-b89) and Java EE 7 SDK does not contain a fix for injection issues that you may experience when CDI, JAX-RS and other injection-aware technologies (e.g. BeanValidation) are used together in one project. While the issue has been fixed in the released Jersey 2.0 binaries, these fixed binaries were not picked by the final GlassFish 4.0 build due to some maven repository stale cache issues. Since we only found out about the issue a day before GlassFish 4.0 and Java EE 7 release, it was not possible to re-spin the build and have it fully tested for the release. I was told by the GlassFish team that they plan to release a new build soon which should contain the final Jersey version as well as any fixes for critical issues reported by the community.

Luckily, GlassFish comes with an Update Tool facility. So, until a new GlassFish build is released, to fix the problem with stale Jersey 2.0 modules, use the update tool to update your GlassFish installation to the released Jersey 2.0 by following these steps (thanks to Jakub for providing them):

After unzipping/installing GlassFish 4.0, switch to the GlassFish installation root directory and launch the following command from the command line:

./bin/updatetool

You should see the following output:

The software needed for this command (updatetool) is not installed.
If you choose to install Update Tool, your system will be automatically
configured to periodically check for software updates. If you would like
to configure the tool to not check for updates, you can override the
default behavior via the tool's Preferences facility.
When this tool interacts with package repositories, some system information
such as your system's IP address and operating system type and version
is sent to the repository server. For more information please see:
http://wikis.oracle.com/display/updatecenter/UsageMetricsUC2
Once installation is complete you may re-run this command.
Would you like to install Update Tool now (y/n):

Enter y (yes) to get the Update Tool software installed. You will see the following information (or similar):

Once the installation finishes, launch the ./bin/updatetool command again – a GlassFish Update Tool window will pop up.

Click on the “Available Updates” under your “GlassFish” application image in the left panel to verify that a newer version of Jersey 2.0 is available:

Then, click on the big green arrow in the toolbar or right-click on the Jersey item in the list and select “Install Marked Components”. After accepting the license agreement, GlassFish Update Tool will automatically update the Jersey version in your GlassFish 4.0 installation to the correct, released version of Jersey 2.0. Once updated, you should see the “Jersey 2 Core,…” listed with the new version “2.0-0.2″ under “Installed Components”:

Enjoy

Note that you can use the process above in the future to update your GlassFish 4.0 installation with newer versions of Jersey 2.