Tuesday, October 13, 2015

Deploy JAX-RS 2.0 REST Webservice on WebLogic 12c

Creating a JAX-RS 2.0 (REST) style web service and deploy it to a WebLogic 12.1.3 server deployment will fail. The reference implementation of JAX-RS 2.0 library is missing from server. WebLogic 12c comes with Jersey 2.5.1 jar installed on filesystem but not deployed by default on WebLogic.

For example when deploy a REST Webservice created from JDeveloper 12c you will get the following error:

[12:14:18 AM] ----  Deployment started.  ----

[12:14:18 AM] Target platform is  (Weblogic 12.x).

[12:14:18 AM] Retrieving existing application information

[12:14:18 AM] Running dependency analysis...

[12:14:18 AM] Building...

[12:14:18 AM] Deploying profile...

[12:14:18 AM] Wrote Web Application Module to /home/chris/workspace/TestRestApp/TestRestWebService/deploy/TestRestApp.war

[12:14:18 AM] Deploying 0 data source(s) to the server...

[12:14:18 AM] Deploying Application...

[12:14:19 AM] [Deployer:149191]Operation "deploy" on application "TestRestApp" is initializing on "adfsrv1".

[12:14:19 AM] [Deployer:149193]Operation "deploy" on application "TestRestApp" has failed on "adfsrv1".

[12:14:19 AM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application TestRestApp on adfsrv1.: Error: Unresolved Webapp Library references for "WebAppModule(TestRestApp:TestRestApp.war)", defined in weblogic.xml [Extension-Name: jax-rs, Specification-Version: 2, exact-match: false].

[12:14:19 AM] weblogic.application.ModuleException: Error: Unresolved Webapp Library references for "WebAppModule(TestRestApp:TestRestApp.war)", defined in weblogic.xml [Extension-Name: jax-rs, Specification-Version: 2, exact-match: false]

[12:14:19 AM] Deployment cancelled.

[12:14:19 AM] ----  Deployment incomplete  ----.

[12:14:19 AM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)


To resolve this error we need to deploy the Jersey 2.5.1 war file from filesystem. The path where this war is installed is MW_HOME/wlserver/common/deploayble-items. The file is the jax-rs-2.0.war. Installing this war file as library on WebLogic will solve the deployment of REST webservices error.



Reference to WebLogic documentation:
https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF290

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.