Oracle Container for Java - OC4J
<?xml version="1.0"?>
<application-server xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/application-server-10_1.xsd" application-directory="../applications"
check-for-updates="adminClientOnly"
deployment-directory="../application-deployments"
connector-directory="../connectors"
schema-major-version="10" schema-minor-version="0" >
.
.
..
<web-site default="true" path="./default-web-site.xml" />
<web-site path="./rahan-web-site.xml" />
<cluster id="139629554608064" />
</application-server>
This will enable the OC4J to read the rahan.web-site.xml file which is also create with above command
the file rahan-web-site.xml
3) Deploy Application.
Deploy the application with the following command. in this example we would be deploying
the ascontrol.ear application
Deploy ear file
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <pwd>
-deploy
-file <path-to-ear-file>
-deploymentName <name>
example
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <pwd>
-deploy
-file c:\ascontrol.ear
-deploymentName ascontrol
Below options for Undeploy and Redploy given for ready reference
Redeploy an application:
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <pwd>
-redeploy
-file <path-to-file>
-deploymentName <name>
Undeploy an application:
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <pwd>
-undeploy <name>
4) Binding the Application to the new site
In the rahan-web-site.xml file add the following line
<web-app application="ascontrol" name="ascontrol" root="/ascontrol"/>
So it looks like this
<?xml version="1.0"?>
<web-site xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/web-site-10_0.xsd" port="9991" display-name="mohan" schema-major-version="10" schema-minor-version="0" >
<default-web-app application="default" name="defaultWebApp" />
<web-app application="ascontrol" name="ascontrol" root="/ascontrol"/>
<access-log path="../log/mohan-web-access.log" split="day" />
</web-site>
....update in progress
===============
Standalone OC4J
Install j2ee set the following variable
JAVA_HOME
J2EE_HOME
Update the path variable to include the the bin directory of jdk
Extract the oc4j_extended.zip to folder (e.g c:\oc4j_dir) and set the following variable
ORACLE_HOME=C:\oc4j_dir
Now lets start the container, execute the following to start it , at the time of first start-up
it will ask for oc4jadmin to be set
C:\OC4J_HOME\j2ee\home>java -jar oc4j.jar
2010-09-09 17:42:23.497 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\dms.war...
2010-09-09 17:42:23.497 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\d
ms.war in C:\OC4J_HOME\j2ee\home\applications\dms
2010-09-09 17:42:23.528 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\dms.war
2010-09-09 17:42:23.528 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\JMXSoapAdapter-web.war...
2010-09-09 17:42:23.543 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\J
MXSoapAdapter-web.war in C:\OC4J_HOME\j2ee\home\applications\JMXSoapAdapter-web
2010-09-09 17:42:23.559 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\JMXSoapAdapter-web.war
2010-09-09 17:42:23.637 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\jmsrouter.war...
2010-09-09 17:42:23.653 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
msrouter.war in C:\OC4J_HOME\j2ee\home\applications\jmsrouter
2010-09-09 17:42:23.668 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\jmsrouter.war
2010-09-09 17:42:23.684 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\conne
ctors\datasources\datasources.rar...
2010-09-09 17:42:23.684 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\connectors\dat
asources\datasources.rar in C:\OC4J_HOME\j2ee\home\connectors\datasources\dataso
urces
2010-09-09 17:42:23.700 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\connectors\datasources\datasources.rar
2010-09-09 17:42:23.700 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\conne
ctors\OracleASjms\OracleASjms.rar...
2010-09-09 17:42:23.700 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\connectors\Ora
cleASjms\OracleASjms.rar in C:\OC4J_HOME\j2ee\home\connectors\OracleASjms\Oracle
ASjms
2010-09-09 17:42:23.731 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\connectors\OracleASjms\OracleASjms.rar
Sep 9, 2010 5:42:23 PM com.evermind.server.XMLDataSourcesConfig parseRootNode
INFO: Legacy datasource detected...attempting to convert to new syntax.
2010-09-09 17:42:23.809 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\javasso.ear...
2010-09-09 17:42:23.825 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
avasso.ear in C:\OC4J_HOME\j2ee\home\applications\javasso
2010-09-09 17:42:23.840 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\javasso.ear
2010-09-09 17:42:23.856 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\javasso\javasso-web.war...
2010-09-09 17:42:23.856 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
avasso\javasso-web.war in C:\OC4J_HOME\j2ee\home\applications\javasso\javasso-we
b
2010-09-09 17:42:23.872 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\javasso\javasso-web.war
2010-09-09 17:42:23.872 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\ascontrol.ear...
2010-09-09 17:42:23.887 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\a
scontrol.ear in C:\OC4J_HOME\j2ee\home\applications\ascontrol
2010-09-09 17:42:26.965 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\ascontrol.ear
2010-09-09 17:42:26.965 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\ascontrol\ascontrol.war...
2010-09-09 17:42:26.981 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\a
scontrol\ascontrol.war in C:\OC4J_HOME\j2ee\home\applications\ascontrol\ascontro
l
2010-09-09 17:42:30.403 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\ascontrol\ascontrol.war
Sep 9, 2010 5:42:31 PM com.evermind.server.XMLApplicationServerConfig randomizeJ
taAdminPassword
INFO: Updating JtaAdmin account
10/09/09 17:42:31 Set OC4J administrator's password (password text will not be d
isplayed as it is entered)
Enter password:
Confirm password:
Confirm password: The password for OC4J administrator "oc4jadmin" has been set.
10/09/09 17:42:39 The OC4J administrator "oc4jadmin" account is activated.
10/09/09 17:42:51 Oracle Containers for J2EE 10g (10.1.3.5.0) initialized
C:\OC4J_HOME\j2ee\home>java -jar oc4j.jar
2010-09-09 17:42:23.497 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\dms.war...
2010-09-09 17:42:23.497 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\d
ms.war in C:\OC4J_HOME\j2ee\home\applications\dms
2010-09-09 17:42:23.528 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\dms.war
2010-09-09 17:42:23.528 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\JMXSoapAdapter-web.war...
2010-09-09 17:42:23.543 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\J
MXSoapAdapter-web.war in C:\OC4J_HOME\j2ee\home\applications\JMXSoapAdapter-web
2010-09-09 17:42:23.559 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\JMXSoapAdapter-web.war
2010-09-09 17:42:23.637 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\jmsrouter.war...
2010-09-09 17:42:23.653 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
msrouter.war in C:\OC4J_HOME\j2ee\home\applications\jmsrouter
2010-09-09 17:42:23.668 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\jmsrouter.war
2010-09-09 17:42:23.684 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\conne
ctors\datasources\datasources.rar...
2010-09-09 17:42:23.684 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\connectors\dat
asources\datasources.rar in C:\OC4J_HOME\j2ee\home\connectors\datasources\dataso
urces
2010-09-09 17:42:23.700 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\connectors\datasources\datasources.rar
2010-09-09 17:42:23.700 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\conne
ctors\OracleASjms\OracleASjms.rar...
2010-09-09 17:42:23.700 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\connectors\Ora
cleASjms\OracleASjms.rar in C:\OC4J_HOME\j2ee\home\connectors\OracleASjms\Oracle
ASjms
2010-09-09 17:42:23.731 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\connectors\OracleASjms\OracleASjms.rar
Sep 9, 2010 5:42:23 PM com.evermind.server.XMLDataSourcesConfig parseRootNode
INFO: Legacy datasource detected...attempting to convert to new syntax.
2010-09-09 17:42:23.809 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\javasso.ear...
2010-09-09 17:42:23.825 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
avasso.ear in C:\OC4J_HOME\j2ee\home\applications\javasso
2010-09-09 17:42:23.840 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\javasso.ear
2010-09-09 17:42:23.856 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\javasso\javasso-web.war...
2010-09-09 17:42:23.856 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\j
avasso\javasso-web.war in C:\OC4J_HOME\j2ee\home\applications\javasso\javasso-we
b
2010-09-09 17:42:23.872 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\javasso\javasso-web.war
2010-09-09 17:42:23.872 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\ascontrol.ear...
2010-09-09 17:42:23.887 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\a
scontrol.ear in C:\OC4J_HOME\j2ee\home\applications\ascontrol
2010-09-09 17:42:26.965 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\ascontrol.ear
2010-09-09 17:42:26.965 NOTIFICATION Auto-unpacking C:\OC4J_HOME\j2ee\home\appli
cations\ascontrol\ascontrol.war...
2010-09-09 17:42:26.981 NOTIFICATION Unjar C:\OC4J_HOME\j2ee\home\applications\a
scontrol\ascontrol.war in C:\OC4J_HOME\j2ee\home\applications\ascontrol\ascontro
l
2010-09-09 17:42:30.403 NOTIFICATION Finished auto-unpacking C:\OC4J_HOME\j2ee\h
ome\applications\ascontrol\ascontrol.war
Sep 9, 2010 5:42:31 PM com.evermind.server.XMLApplicationServerConfig randomizeJ
taAdminPassword
INFO: Updating JtaAdmin account
10/09/09 17:42:31 Set OC4J administrator's password (password text will not be d
isplayed as it is entered)
Enter password:
Confirm password:
Confirm password: The password for OC4J administrator "oc4jadmin" has been set.
10/09/09 17:42:39 The OC4J administrator "oc4jadmin" account is activated.
10/09/09 17:42:51 Oracle Containers for J2EE 10g (10.1.3.5.0) initialized
That's it ! the container has been initialized, you could acces the default page at http://<host-name>:8888
For stoping the oc4j instance , issue the following command
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin password -shutdown
Management Of OC4J Command Line Utilities
OC4J Standalone
1) OC4J Standalone and Installation
2) Create a New Website
3) Deploy Application
4) Bind the Application to New site created
So here we go
Above we have already installed the Standalone version of OC4J
Now step 2
2) Creating a New Website
Command
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <admin_pwd>
-createWebSite
-webSiteName <site_name>
-protocol <http|https>
-port <port_value>
example
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <admin_pwd>
-createWebSite
-webSiteName rahan-web-site
-protocol http
-port 9999
What above will do is that it will create a line in the server.xml file which is
Thats It, stop and start the container, you could access the ascontrol application at the new site.
http://<hostname>:<new site port>/ascontrol
========OC4J Listening Ports
OC4J could listen on HTTP/HTTPS, AJP/AJPS Protocol
On which port a particular site is configured to listen on, could be found
in the <websitename>-web-site.xml in the %ORACLE_HOME%/j2ee/config directory
If it is a default site the details could be found in the default-web-site.xml
All the websites which are configured to run through that OC4J instance are referenced
int the server.xml file of the %ORACLE_HOME%/j2ee/config directory
Now when a web-site is configured to use HTTP protocol the OC4J container would directly
listen on that port.
But if the protocol configured is AJP/AJPS then the site is to be accessed through the
Oracle HTTP Server via the mod_oc4j module of the http daemon configured in the httpd.conf
file of the Apache web server.