The largest Interview Solution Library on the web


« Previous | 1 | 2 | 3 | Next »

Rest - Jersey with Glass Fish


12.1. Overriding Jersey with war files

To override the version of Jersey distributed in GlassFish with a version of Jersey distributed in a war file ensure that class loader delegation is set to false in WEB-INF/sun-web.xml or WEB-INF/glassfish-web.xml. For example:

<sun-web-app error-url="">
<context-root>/context</context-root>
<class-loader delegate="false"/>
</sun-web-app>

In the GlassFish admin console, go to Configuration->JVM Settings, switch to the JVM Options tab and add the following option:
-
Dcom.sun.enterprise.overrideablejavaxpackages=javax.ws.rs,javax.ws.rs.core,
javax.ws.rs.ext

Restart GlassFish for new JVM settings to take effect.

12.2. Upgrading Jersey in GlassFish

12.2.1. GlassFish v3.0 and 3.0.1

GlassFish v3.0 comes up with Jersey version 1.1.4.1. GlassFish v3.0.1 with Jersey version 1.1.5. To upgrade these to 1.9 you will need to replace certain files manually.

GlassFish uses Jersey internally in it's REST administration API, and the Update Center client would not allow you to upgrade in order to prevent this functionality. The workaround described in this section is known to work, but it is not currently a tested and supported scenario. Please keep in mind things could break. It is recommended to back up all all impacted files. The actual replace steps follow.

Remove the existing Jersey files: Stop all running server instances. Then remove the following files from the GlassFish installation directory:
  • glassfish/modules/jsr311-api.jar
  • glassfish/modules/jersey-gf-bundle.jar
  • glassfish/modules/jersey-gf-statsproviders.jar
  • glassfish/modules/jersey-multipart.jar
  • glassfish/modules/jackson-core-asl.jar
  • glassfish/modules/jettison.jar
  • glassfish/modules/mimepull.jar
To be 100 % sure the changes take effect, you might also want to remove the felix cache, which is located in glassfish/domains/domain1/osgi-cache directory. This directory gets created upon the first start of the GlassFish instance.

12.2.2. GlassFish 3.1

GlassFish 3.1 is released. GlassFish 3.1 builds can be downloaded from http://glassfish.java.net/downloads/3.1-final.html

If you want to update the Jersey bits in GlassFish with the latest Jersey snapshot version, or if you want to install Jersey documentation and examples, you would need to do the following steps:

Remove the existing Jersey files: Stop all running server instances. Then remove the following files from the GlassFish installation directory:
  • glassfish/modules/jersey-core.jar
  • glassfish/modules/jersey-client.jar
  • glassfish/modules/jersey-gf-server.jar
  • glassfish/modules/jersey-json.jar
  • glassfish/modules/jersey-multipart.jar
  • glassfish/modules/jersey-gf-statsproviders.jar
  • glassfish/modules/jackson-core-asl.jar
  • glassfish/modules/jackson-mapper-asl.jar
  • glassfish/modules/jackson-jaxrs.jar
  • glassfish/modules/jettison.jar
To be 100 % sure the changes take effect, you might also want to remove the felix cache, which is located in glassfish/domains/domain1/osgi-cache directory. This directory gets created upon the first start of the GlassFish instance.
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com