DBA Tips Archive for Oracle
by Jeff Hunter, Sr. Database Administrator
The following document provides a brief introduction to several of the most used commands that can be performed by the OC4J administrator. OC4J provides the
admin.jarcommand-line utility that is used to performing actions like deploying applications, restarting OC4J, and shutting down the OC4J server. For the purpose of this document, I will provide all examples using a fictitious application called
After starting the OC4J server, you can administer the server using the
admin.jarcommand-line tool. The basic syntax for using the
admin.jartool is as follows:java -jar admin.jar ormi://<oc4j_host>:<oc4j_ormi_port> <admin_id> <admin_password> <options>
The following listing is an overview of the variables used with the
<oc4j_host>:<oc4j_ormi_port>- The host name and port of the OC4J server from which you want to manage. The
admin.jarutility uses the OC4J Remote Method Invocation (ORMI) protocol to communicate with the OC4J server. Therefore, the host name and port identified by these variables are defined in the
rmi.xmlfile for the OC4J server to which you are directing the request.
The default port number for the ORMI protocol is 23791. Configure both the host name and port number - if not using the default - in the rmi.xml file in the
attribute, as follows:<rmi-server port="<oc4j_ormi_port>" host="<oc4j_host>" >
<admin_id> <admin_password>- The administration identity and password, required to perform administrative functions. The file
$OC4J_HOME/j2ee/home/config/principals.xmlcontains the usernames, passwords and groups that have access to the OC4J server. By default, OC4J defines the groups administrators, guests, and users. Also included by default are the users user, anonymous, admin, and scott.
admin.jarutility provides many options for managing the OC4J instance. The examples in this document provide the different options used when managing OC4J using
Example Administrative Commands
Starting OC4J InstanceShutting Down OC4J% java -jar oc4j.jar Node started with id=-2479157545 Oracle9iAS (184.108.40.206.0) Containers for J2EE initializedRestarting OC4J% java -jar admin.jar ormi://localhost admin manager -shutdownDeploying an Application% java -jar admin.jar ormi://localhost admin manager -restartRegister the J2EE application (generally the EJBs / business logic):Undeploy Application% java -jar admin.jar ormi://localhost admin manager -deploy -file $OC4J_HOME/j2ee/home/applications/my_app.ear -deploymentName my_app -targetPath applications/This step creates the entry in the server.xml file for the my_app application
To bind the Web application through the admin.jar tool, use the following:% java -jar admin.jar ormi://localhost admin manager -bindWebApp my_app my_app-web http-web-site /my_appThis creates the <web-app> entry element in the http-web-site.xml configuration file.Listing All Available Sites% java -jar admin.jar ormi://localhost admin manager -undeploy my_app% java -jar admin.jar ormi://localhost admin manager -site -list All available sites: Name : Default Oracle9iAS Containers for J2EE Web Site Port : 4169 Host : 0.0.0.0 Secure : false Name : Oracle9iAS Containers for J2EE HTTP Web Site Port : 8888 Host : 0.0.0.0 Secure : false
Copyright (c) 1998-2018 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.