Oracle Application Server (OAS) and OC4J

From Kb

Jump to: navigation, search

Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author

Contents

See Also

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
  • 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

OC4J Configuration

<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" />

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).

  1. Find the following OC4J configuration file in the and open in a text editor:(OC4J-Home)/j2ee/home/config/system-jazn-data.xml
  2. 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>
  1. 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.
  2. Save your changes and restart OC4J.
Personal tools