DBA Tips Archive for Oracle
by Jeff Hunter, Sr. Database Administrator
You can remove a J2EE Web application from the OC4J Web server using either the
-undeployoption with the
admin.jarcommand line tool or by manually deleting the appropriate directories.
Undeploying Application Using admin.jar -undeploy
Syntax% java -jar admin.jar ormi://<oc4j_host>:<oc4j_ormi_port> admin <adminpassword> -undeploy <applicationName> -keepFilesExample% cd $OC4J_HOME/j2ee/home % java -jar admin.jar ormi://localhost admin manager -undeploy chapter5
This command removes the deployed J2EE application known as <applicationName> and results in the following:
- The application is removed from the OC4J runtime.
- All bindings for the Web modules are removed from all the Web sites to which the Web modules were bound.
- The application files are removed from both the
$OC4J_HOME/j2ee/home/application-deployments/directories. If you do not want these files to be removed, use the -keepFiles switch.
Undeploying Application by Manually Deleting Directories
If you want a clean deployment of an application deployed to OC4J, you can perform the following tasks. In this example, I will delete an application title chapter5. The EAR file was deployed to
- Stop the OC4J Instance.% cd $OC4J_HOME/j2ee/home % java -jar admin.jar ormi://localhost admin manager -shutdown
- Delete the application directories under
application-deployments:% cd $OC4J_HOME/j2ee/home/applications % rm chapter05.ear % rm -rf chapter05 % cd $OC4J_HOME/j2ee/home/application-deployments % rm -rf chapter5
- Edit the file
$OC4J_HOME/j2ee/home/config/server.xmland remove the element that describes the chapter5 application:<application name="chapter5" path="../applications/chapter05.ear" root="/chapter5" auto-start="true" />
- Edit the file
$OC4J_HOME/j2ee/home/config/http-web-site.xmland remove the element that describes the chapter5 application:<web-app application="chapter5" name="chapter05-web" root="/chapter5" load-on-startup="true" />
- Start OC4J again:% cd $OC4J_HOME/j2ee/home % java -jar oc4j.jar
Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at email@example.com.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.