This appendix describes how to update the version of the Jersey JAX-RS Reference Implementation (RI) used by your RESTful Web service applications.
This appendix includes the following sections:
WebLogic Server supports Jersey 1.13 JAX-RS Reference Implementation (RI), which is a production quality implementation of the JSR-311 JAX-RS 1.1 specification, defined at: https://jcp.org/en/jsr/summary?id=311
. As required, you can use a more recent version of the Jersey JAX-RS RI at the application level.
In WebLogic Server, any JAR file present in the system classpath is loaded by the WebLogic Server system classloader. All applications running within a server instance are loaded in application classloaders which are children of the system classloader. If a third-party JAR exists in the system classloader, applications must use a filtering classloader to load and use a different version.
The filtering classloader provides a mechanism for you to configure deployment descriptors to explicitly specify that certain packages should always be loaded from the application, rather than being loaded by the system classloader. For more information about using a filtering classloader, see "Using a Filtering Classloader" in Developing Applications for Oracle WebLogic Server.
To update the version of Jersey JAX-RS RI at the application level, use one of the following procedures based on whether you are updating an EAR or WAR file:
To update the version of Jersey JAX-RS RI in an EAR file:
Include the preferred Jersey JAX-RS RI packages with the deployed Web application.
Edit the weblogic-application.xml
deployment descriptor packaged with your application EAR file to include a <prefer-application-packages>
element with the preferred library packages listed. For more information about adding the <prefer-application-packages>
element to weblogic-application.xml
, see "weblogic-application.xml Deployment Descriptor Elements" in Developing Applications for Oracle WebLogic Server.
Example A-1 provides an example of how to update the weblogic-application.xml
file.
Example A-1 Updating the Version of Jersey JAX-RS RI in a weblogic-application.xml File
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.oracle.com/technology/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd" xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"> <prefer-application-packages> <!-- jersey-bundle-*.jar --> <package-name>com.sun.jersey.*</package-name> <package-name>com.sun.research.ws.wadl.*</package-name> <package-name>com.sun.ws.rs.ext.*</package-name> <!-- Jackson-*.jar --> <package-name>org.codehaus.jackson.*</package-name> <!-- jettison-*.jar --> <package-name>org.codehaus.jettison.*</package-name> <!-- jsr311*.jar --> <package-name>javax.ws.rs.*</package-name> <!-- asm.jar --> <package-name>org.objectweb.asm.*</package-name> </prefer-application-packages> ... </weblogic-web-app>
To update the version of Jersey JAX-RS RI in an WAR file (packaged standalone or within an EAR file):
Include the preferred Jersey JAX-RS RI packages with the deployed Web application.
Edit the weblogic.xml
deployment descriptor packaged with your application WAR file to include a <prefer-application-packages>
element with the preferred library packages listed. For more information about adding the <prefer-application-packages>
element to weblogic.xml
, see "prefer-application-packages" in Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server.
Example A-2 provides an example of how to update the weblogic.xml
file.J
Example A-2 Updating the Version of Jersey JAX-RS RI in a weblogic.xml File
<?xml version="1.0" encoding="UTF-8"?> <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.5/weblogic-web-app.xsd"> ... <wls:container-descriptor> <wls:prefer-application-packages> <!-- jersey-bundle-*.jar --> <wls:package-name>com.sun.jersey.*</wls:package-name> <wls:package-name>com.sun.research.ws.wadl.*</wls:package-name> <wls:package-name>com.sun.ws.rs.ext.*</wls:package-name> <!-- Jackson-*.jar --> <wls:package-name>org.codehaus.jackson.*</wls:package-name> <!-- jettison-*.jar --> <wls:package-name>org.codehaus.jettison.*</wls:package-name> <!-- jsr311*.jar --> <wls:package-name>javax.ws.rs.*</wls:package-name> <!-- asm.jar --> <wls:package-name>org.objectweb.asm.*</wls:package-name> </wls:prefer-application-packages> </wls:container-descriptor> </wls:weblogic-web-app>