JAX RS 2.0 on Weblogic 12.1.3

Java API for RESTful Web Services (JAX-RS) is a Java programming language API that provides support in creating web services according to the REST architecture. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints.

Support for JAX-RS 2.0 in WebLogic Server 12.1.3 is provided through the integration of the Jersey 2.5.1 library. The Jersey 2.5.1 library provides the Reference Implementation (RI) of JSR-399 (JAX-RS 2.0: Java API for RESTful Web Services) and is delivered as a shared library. So the first step is to register the Jersey 2.5.1 shared library.

Registering the Jersey 2.5.1 (JAX-RS 2.0 RI) Shared Library With Your WebLogic Server Instances

Using the administrative console, we can register the library by following these steps:

  1. Log into the WebLogic Server Administration : http://host:port/console
  2. Select Deployments.
  3. Click Install to install the shared library.
  4. In the Path field, enter or navigate to the following directory: MW_HOME\wlserver\common\deployable-libraries.
  5. Select the jax-rs-2.0.war file.
  6. Click Next.
  7. Select Install this deployment as a library.
  8. Click Next.
  9. Click Finish.

Create a sample Web Application

For creating the web application I prefer to use Eclipse for Java EE. I created a new Dynamic Web Project. For the demo purpose, I am going to create a simple web application and not an Enterprise web application, which is recommended by Oracle.

1jax

Create a package

2jax

Create class

Created an Example class and scripted a simple Hello world Application.(Note the folder structure to the right of the image)

3jax

Export as a WAR file

5jax

Deploy the application on the weblogic server

4jax

Test

Access the rest url via a browser to test. http://<host>:<port>/<contextPath>/resources/helloworld

6jax

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *