Theodore K.
Theodore K.

Reputation: 5176

Jersey 1.18 in weblogic 12.2

I have a web service in a weblogic 12.1 server (where it works) that I now have to transfer in a new weblogic 12.2 server. In my WEB-INF/lib jars I have jersey 1.18 files. However when I deploy it, it seems that Jersey 1.18 gets overridden by Jersey 2.21 and by calling the web service I get a "404 not found error". Application.wadl now has <ns0:doc ns1:generatedBy="Jersey: 2.21.1 2015-09-16..."/> so I guess that's where the problem is.

I tried putting a weblogic.xml file in WEB-INF with:

<container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

but nothing changed. How can I force using Jersey 1.18 ?

Upvotes: 4

Views: 3882

Answers (3)

oracode
oracode

Reputation: 76

weblogic 12.2.x does not support jersey 1.x server api any more. It is better to use jersey 2.x api. For the 404 issue, I think you can use this link to change your app .

http://docs.oracle.com/middleware/1221/wls/RESTF/jersey-back-comp.htm#RESTF385

Upvotes: 2

Hamza Ali Siddiqui
Hamza Ali Siddiqui

Reputation: 121

You may resolve the issue by changing your web.xml:
Before:
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
After:
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

Upvotes: 0

Ilan Salviano
Ilan Salviano

Reputation: 84

A safer way to enforce the library version you need is to use shared-libs and reference then in the weblogic.xml file. Here's a sample so you can take a look:

<?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://xmlns.oracle.com/weblogic/weblogic-web-app 
           http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">

    <wls:library-ref>
       <library-name>jax-rs</library-name>
       <specification-version>2.0</specification-version>
       <exact-match>false</exact-match>
    </wls:library-ref>
</wls:weblogic-web-app>

I invite you to access this link to get the detailed process on how to register your jersey lib as shared libs on weblogic instances.

Upvotes: -1

Related Questions