Thursday, June 21, 2018

Upgrade: Jersey 1.x to 2.x


In order to be on the latest stable versions of the middleware technology stack, I upgraded by webapplication from Jersey1.x to Jersey2.x. Here are the details of the migration that might be helpful for those who are facing any issues while performing Jersey upgrade.

Name Old New
Java Java 8 Java 8
Spring 4.2.1 4.2.1
Hibernate 5.3.1 5.3.1
mysql-jdbc-connector 5.1.6 5.1.6
Jersey 1.8 2.27
JSON-B Provider Genson 1.4 Jackson 2.27
Jersey-Spring Jersey-spring 1.8 Jersey-spring4  2.27
Tomcat7.x.x8.0.23

As part of upgrade, it is not sufficient to update maven dependencies from Jersey 1.8 to 2.27 but also modifying web.xml configuration too to complete the task.

Dependency Entries: Following table lists the old and updated entries to be part of pom.xml file of the project


Update to the web.xml: Because of huge code refactoring from Jersey 1 to Jersey 2, the  core class itself it being changed and more. Following is the git sample showing the config changes in web.xml



Note: Dont get mislead by name of the core Jersey2 servelt which is ending with Container. It shoud be treated as a regular dispatcher-servlet and not to be confused with other containers such as SpringIOC or Tomcat 

No comments:

How J2EE components work together in any Container - Spring or Application Server

In a Spring+Jersey+Hibernate RESTful webapplication, we can spot various J2EE components - JTA, JPA, Java Bean Validation, JSON-B API for B...