Friday, February 13, 2015

ADF Shared Library - Deploying ADF War as Shared Lib

In Oracle ADF Applications , mostly the architecture is like there are task flow applications which can be based on module and then there is one main consuming application.

In this post we will see how we can deploy the ADF applications as Shared Library. ADF Application consisting of task flow will be packed as WAR and will be deployed as shared library to weblogic. Then The Main Consuming Application will refer the Task Flow App and use the task flow from shared library.

Lets get started.

Created a simple ADF Application and created DepartmentsEO/VO out of HR Schema in Model project. ViewController project consist of Task Flow with one page fragment which has an output text and a ADF Table out of DepartmentsVO.  Also created a DataSource jdbc/HRDS in weblogic console and Application Module is referring to this DS.




Now comes the main part. In order to deploy WAR as a shared lib , we need to have MANIFEST.MF file. This file one needs to create in TaskFlowFirstApp\src\META-INF folder. After this, it will be seen under Application Resources.


Below is the contents of MANIFEST.MF file.





Now create a WAR Profile under deployment options for ViewController Project.


In WAR Options add the MANIFEST.MF file created above as shown.

Thats it, now deploy the ViewController WAR as Shared Lib on weblogic server.



Select the server to deploy (Integrated server in this example). In next screen remember to select Deploy as a shared library.


Do a next and deploy. Deploy will be successful and it is available under Deployments as shared library.


taskflow.shared.lib(1.1) it shows the version number along with shared lib.

We are all set with task flow application as Shared Library. Now lets work on Consuming application.

Last thing is to create a ADFSharedLibrary out of TaskFlowFirstApp , so that it can be referred at design time in Jdeveloper. Create a deployment profile for ADF Library Jar and deploy to a folder.   

Consuming Application 

Created another ADF application as Main Application(Consuming Application)

ViewController project has been given dependency on ADF Library Jar created above.



Remember that you should not check Deploy By Default. 

Now create a jspx page and drag the FirstTaskFlow from Components Palette to the page.




Now comes the main part of consuming application. We need to refer the deployed shared library in this application so that when it gets deployed on weblogic, it refers the task flow (FirstTaskFlow) from the shared library.

So create a weblogic.xml in WEB-INF. In weblogic.xml just add the reference of the shared library by adding the name.



Thats it. Now deploy the main application as an EAR. 


Do as standalone application. The application will be now seen in deployments in weblogic console.



We are all set. Now just run the application. One can see the 

Sample applications can be downloaded from below :




Thanks !!


10 comments:

  1. This seems to be very close to my post from 2010: http://andrejusb.blogspot.com/2010/07/deploying-adf-applications-as-shared.html It would be nice if you could put a reference link.

    ReplyDelete
  2. Hi Andrejus,
    How are you. I have added the reference to your link in the post. It is different than your post. It does not uses a separate WAR project to contain the ADF Libs. It uses the same ViewController project to deploy as a jar.

    Also it provides the details steps by step to implement the same and it is a like a reference to myself how to do this later.

    I am sorry if you felt not good about this.

    Thanks
    Rohan

    ReplyDelete
  3. hi rohan,

    instead of deploying the child project as a separate library, why cant we deploy as adf library jar and consume it in parent project, which will avoid deploying and making changes in weblogic.xml.

    thanks.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi,
    Can you please guide me how to import a task flow library which is within the same application. My Jdev version is 12.2.1.1.0.

    Thanks in advance.

    ReplyDelete
  6. Hi Ramya,

    You were mentioning it in your comment that:
    'instead of deploying the child project as a separate library, why cant we deploy as adf library jar and consume it in parent project, which will avoid deploying and making changes in weblogic.xml.'

    Can you please provide steps how to do it.

    Thanks in advance.

    ReplyDelete