Oracle Application Server (OAS) and OC4J
From Kb
Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author
Contents |
See Also
- Deploying to Weblogic using Maven
- JBoss Information
- Oracle Application Server (OAS)
- Tomcat Web Server
- Websphere
- Weblogic
Versions
- OAS - Oracle Application Server - Production J2EE Server
- OC4J - Oracle Components 4 Java - Personal / Development Version
There are known differences in behaviour between the two versions.
Installing OC4J
- Ensure you have Java 1.4 or higher installed
- Download OC4J from Oracle Site
- Unzip to target directory on your PC
- Set the following Environment Variables
- ORACLE_HOME : the directory where you unzipped oc4j_extended.zip
- JAVA_HOME : location of Java (should be set already when Java is installed).
- More information : Main OC4J page (inc Docs) on Oracle Site
OC4J Port Numbers and startup options
- Port Numbers
- Admin: http://localhost:23791/
- Default username / password is amadmin /welcome
- Normal : http://localhost:8888/
- Admin: http://localhost:23791/
- Startup
- Open Dos / Command console
- Navigate to OC4J/Bin directory
- run the following script: oc4j -start
- Other Options
-start : start OC4J -shutdown -port <ORMI port> -password <password> : stop OC4J -version : display the version
- ctrl-c (within the command window) also allows for graceful shutdown
- To get list of deployed applications on your local server:
- Login to Admin console
- Navigate to : http://localhost:8888/em/console/ias/oc4j/applications
OC4J Configuration
- OC4J config files are in : (InstallDir)\OC4J\j2ee\home\config
- To Enable JSP Debugging
- How to set Set the init-param debug_mode to true to see the complete exception message
- Add this to your webapps web.xml to enable debugging on exceptions within the JSP
- Redeploy the app / restart the OC4J container
<servlet> <servlet-name>jsp</servlet-name> <servlet-class>oracle.jsp.runtimev2.JspServlet</servlet-class> <init-param> <param-name>debug_mode</param-name> <param-value>true</param-value> </init-param> </servlet>
Oracle and Custom ANT Tasks
- import the Oracle Ant Tags
- use the 'import' tag , nested just inside the root project tag (in the ant build script). This is a standard file that comes bundled with OC4J, , in this case it assumes that OC4J is installed in c:\oc4j directory (change if required).
<import file="/oc4j/j2ee/utilities/ant-oracle.xml" />
- Use them below to script (via Ant) tasks on the OC4J / OAS server
- List of available Ant-Oracle tasks
- Other useful Oracle Database Ant Tasks
Deployment to OC4J Via ANT
- Build War file as normal
- Use following ANT tasks to deploy to (running) OC4J server
<!--Push the War file onto the OC4J server--> <oracle:deploy deployerUri="{name.of.uri.on.localhost}" userid="${oc4j.admin.user}" password="${oc4j.admin.password}" file="${location.of.war.file}" deploymentname="${app.name}" logfile="${log.dir}/deploy-war.log" /> <!--Make the War / Java Application available via a URL--> <oracle:bindWebApp deployerUri="{name.of.uri.on.localhost}" userid="${oc4j.admin.user}" password="${oc4j.admin.password}" deploymentname="${app.name}" webmodule="${web.name}" websitename="${oc4j.binding.module}" contextroot="/${app.name}" />
Creating Data Sources
<target name="createIasDS" > <oracle:createManagedDataSource deployerUri="${deploy.uri}" userId="${oc4j.admin.user}" password="${oc4j.admin.password}" dataSourceName="${oc4j.datasource.name}" applicationName="default" jndiLocation="${oc4j.datasource.jndi.name}" connectionPoolName="${oc4j.connection.pool.name}" /> </target>
Other Ant and Oracle Info
OAS / OC4J Log file locations
- {installDir}\OC4J\j2ee\home\log
- {installDir}\OC4J\j2ee\home\application-deployments\{appName}
Manual Password Change
For when you have access to the config files , but cannot remember the password to login via the console (and hence change it there).
- Find the following OC4J configuration file in the and open in a text editor:(OC4J-Home)/j2ee/home/config/system-jazn-data.xml
- Find the following entry
<user> <name>oc4jadmin</name> <display-name>OC4J Administrator</display-name> <guid>asdfklasjdfasdfasd</guid> <description>OC4J Administrator</description> <credentials>{903}2345fga5348fsadf</credentials> </user>
- Replace the value of the <credentials> section with the new password. Put an exclamation mark character (!) before the password.. This tells OC4j to encrypt the password on startup.
- Save your changes and restart OC4J.

