Download, install and configure the Oracle OC4J 10.1.3.5 stand alone server
- Go to the Oracle Internet Application Server
site. Click on the Downloads
tab and all available Application Server 10g Release 3 (10.1.3.x) Downloads
will be displayed.
- Scroll down until you reach the Oracle Containers for J2EE section and click on Pure Java
. The Oracle Application Server 10g Software Downloads
will be displayed.
- Accept the License Agreement, then click on the Oracle Containers for J2EE 10g (OC4J) link. The download of the oc4j_extended_101350.zip file will start. Save this zip file on your workstation.
Install
- In your $
Unknown macro: {user.home}/oc4j/10.3.5.0 will be your ORACLE_HOME.
directory, create the directories oc4j/10.1.3.5.0/. The full directory path ${
Configure
- the configur
Unzip it somewhere
I used [user.home]/oc4j/10.1.3.5.0/ That way I can keep multiple versions of OC4J.
Note: It is recommended not to install oc4j in a path which has spaces in it (e.g. C:\Program Files) as such configuration will cause compilation errors when JasperReports attempted to use the oc4j path to compile reports.
According to the findings of one of our developers, JasperReports will substitue the space between the text "Program" and "Files" in the name with "%20" and the compilation will result in error.
Configure
In OC4J 10.1.3 I actually had to comment out this line in [j2ee.home]/config/system-application.xml like so
<!--import-shared-library name="oracle.toplink"-->
to get Hibernate to work correctly. Something to to with antlr packages conflicting with OC4J's.
Swapping Out The OC4J 10.1.3 XML Parser
In order to use Spring 3.0 with OC4J 10.1.3, you'll need to swap out the default XML parser in OC4J with something more modern. xercesImpl.jar and xml-apis.jar work fine. To swap the parser out, you need to create a new shared library in the OC4J enterprise manager and then edit the system-application.xml file to use your new shared library instead of the Oracle XML parser.
- Open $OC4J_HOME/j2ee/home/application-deployments/default/orion-application.xml in a text editor. On my system, it did not exist, so I had to create it.
- If you had to create the file anew, these are the contents of the file:
<?xml version='1.0' encoding='utf-8'?> <orion-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd" schema-major-version="10" schema-minor-version="0" component-classification="internal"> <imported-shared-libraries> <remove-inherited name="oracle.xml"/> </imported-shared-libraries> </orion-application>
If you had an existing file, add this block to it:
<imported-shared-libraries> <remove-inherited name="oracle.xml"/> </imported-shared-libraries>
Once you save these files and restart OC4J, you will be using the new XML parser.
Getting Better Debugging Information From OC4J
By default, some run time errors that you'll see when testing web apps in OC4J are not too helpful. You can coax OC4J into giving you more information about certain errors by these changes in global-web-application.xml :
1. Turn on "development" mode - in the <orion-web-app> section at the top of the file, change the "development" setting to true:
<orion-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd" jsp-cache-directory="./persistence" servlet-webdir="/servlet" development="true" jsp-timeout="0" jsp-cache-tlds="standard" schema-major-version="10" schema-minor-version="0">
2. Turn on debug mode. In the "jsp" servlet section, set a parameter debug_mode to true. The section should look like this:
<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> <load-on-startup>0</load-on-startup> </servlet>
With these settings, you should get more meaningful messages in your browser when you run into certain errors (JSP syntax errors for example).
Add a Datasource
We need to add a datasource to our applications can pull data from the database. Edit [j2ee.home]/config/data-sources.xml to add a datasource. Here's an example of adding a MITSIS datasource:
<data-source class="com.evermind.sql.DriverManagerDataSource" name="OracleDS2" location="jdbc/MitsisDS" xa-location="jdbc/xa/StargateXADS-unused" ejb-location="jdbc/OracleDS-unused" connection-driver="oracle.jdbc.driver.OracleDriver" username="" password="" url="jdbc:oracle:thin:@//earth-vault-2.mit.edu:1523/sundev2" inactivity-timeout="30" />
where obviously you'll add your username and password.