onsdag, juli 05, 2006

Incremental Deployment using JDeveloper & OC4J

In the JDeveloper online help and in the OC4J Deployment Guide 10.1.3, the option to use virtual directories is mentioned. This feature can be used to implement incremental deployment using JDeveloper & OC4J.

Here is how it works:
The element 'virtual-directory' adds a virtual directory mapping for static content. This is conceptually similar to symbolic links on a UNIX system. The virtual directory enables you to make files in the "real" document root directory available to the application, even though the files do not physically reside in the Web application WAR file.


Here is an example:

1. Start JDeveloper & a standalone OC4J Server (10.1.3 versions).
2. Create a new Workspace in JDeveloper, with 2 empty projects.
3. In Project 1, create a new HTML page.
4. Create a new WAR deployment profile for Project 1, set the J2EE Context to 'foo'.
5. Deploy the application to the standalone OC4J server.
6. Ensure that you can access the HTML file from a browser.
7. In Project 2, create a new JSP file.
8. Add the deployment descriptor orion-web.xml to Project 2. Add this line to that file:

<virtual-directory virtual-path="/foo" real-path="D:\oracle\oc4j1013\j2ee\home\applications\webapp1\webapp1" />

You need, of course, to alter the real-path to where your first application has been deployed. You could also have placed the files directly somewhere on the server, and referenced this directory here instead of creating a Project and deploying them.

9. Create a new WAR deployment profile in Project 2, set the J2EE Context to 'fuu'.
10. Deploy the application to the standalone OC4J server.
11. Ensure that you can access the JSP file from a browser.
12. Now you will be able to access the HTML file by using:

http://localhost:8888/fuu/foo/untitled1.html

13. Alter the JSP in Project 2 and re-deploy Project 2. Notice that you can still access the HTML file from the above URL without having to re-deploy also these files.