Search This Blog

Wednesday 2 March 2011

Deploying a RESTful Web Service From JDeveloper 11g to Weblogic 10.3.4

I previously blogged how to create a RESTFul Web Service in JDeveloper 11g as per this entry. Here are the steps required to now deploy this to WLS 10.3.4 directly from JDeveloper itself. It's just a few basic steps.

1. Ensure you have deployed the rqeuired Jersey libraries on WLS 10.3.4 and targetted them to the managed server you are going to deploy to. Those libraries are shipped with WLS 10.3 in $WLS_HOME/common/deployable-libraries.


2. Create a weblogic.xml within your "Demo" project which includes the references to the 2 libraries above.

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
                  xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <context-root>jaxrs-demo</context-root>
  <library-ref>
    <library-name>jersey-bundle</library-name>
    <specification-version>1.1.1</specification-version>
    <implementation-version>1.1.5.1</implementation-version>
  </library-ref>    
  <library-ref>
    <library-name>jsr311-api</library-name>
    <specification-version>1.1.1</specification-version>
    <implementation-version>1.1.1</implementation-version>
  </library-ref>
</weblogic-web-app>

3. Create a WAR deployment profile within your "Demo" project ensuring you don't deploy the libraries you used in JDeveloper. They are not needed as the libraries exist in WLS 10.3.4 which we are referencing. In short your WAR file would only contain 3 files here.


  1004 Wed Mar 02 13:08:34 EST 2011 WEB-INF/classes/pas/au/jdev/rs/HelloWorld.class
   635 Tue Mar 01 10:50:52 EST 2011 WEB-INF/web.xml
   780 Wed Mar 02 13:08:16 EST 2011 WEB-INF/weblogic.xml

4. Deploy the WAR file targeting it to the managed server from JDeveloper itself.

[01:10:00 PM] ----  Deployment started.  ----
[01:10:00 PM] Target platform is  (Weblogic 10.3).
[01:10:32 PM] Retrieving existing application information
[01:10:33 PM] Running dependency analysis...
[01:10:33 PM] Building...
[01:10:33 PM] Deploying profile...
[01:10:34 PM] Wrote Web Application Module to C:\jdev\jdevprod\11114\jdeveloper\jdev\mywork\JAX-RS-RESTFulWebServices\Demo\deploy\helloworld-jaxrs.war
[01:10:37 PM] Deploying Application...
[01:11:08 PM] [Deployer:149191]Operation 'deploy' on application 'helloworld-jaxrs' is initializing on 'apple'
[01:11:12 PM] [Deployer:149192]Operation 'deploy' on application 'helloworld-jaxrs' is in progress on 'apple'
[01:11:16 PM] [Deployer:149194]Operation 'deploy' on application 'helloworld-jaxrs' has succeeded on 'apple'
[01:11:24 PM] [Deployer:149191]Operation 'deploy' on application 'helloworld-jaxrs' is initializing on 'apple'
[Deployer:149192]Operation 'deploy' on application 'helloworld-jaxrs' is in progress on 'apple'
[01:11:24 PM] Application Deployed Successfully.
[01:11:28 PM] The following URL context root(s) were defined and can be used as a starting point to test your application:
[01:11:28 PM] http://10.187.81.36:7003/jaxrs-demo
[01:11:30 PM] Elapsed time for deployment:  1 minute, 30 seconds
[01:11:30 PM] ----  Deployment finished.  ----

3 comments:

Jose said...

Thanks for posting this.
In my case, I had a clash with class org.objectweb.asm.ClassReader loaded by the system loader, so I deployed the asm.jar with the project and created a filter so the class in the my project would be used: The weblogic.xml file was:


appinvoutbound


org.objectweb.asm.*

Jose said...

Thanks for your post.
In my case I had to deploy with the asm-3.1.jar and create a filter so the ClassReader.class from that library was used, instead of the one loaded by the system. The weblogic.xml was


jaxrsdemo


org.objectweb.asm.*

vyshakh said...

BRILLLLLLLIAAANNNTT POSSSSTT!!!