Raible's Wiki

Raible Designs
Wiki Home
Recent Changes


  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in

Edit this page

Referenced by

JSPWiki v2.2.33


Hide Menu


Steps for running Appfuse under OracleAs (Orion) OC4J 9.0.4

Contributed by Mike Lawrence (mike at systemsplanet.com) Feb 04, 2004. Original is attached(info) at the bottom of this page.

This page includes instructions for installing and configuring AppFuse to run on the Oracle Application Server (Orion). Special Thanks to Matt for his help in getting this up and running!

For Oracle AS 10g Release 2 (, see AppFuseOnOracleAS10g.

NOTE: You will have to change the "contextConfigLocation" <context-param> in web.xml (metadata/web/web-settings.xml) to specify each context file individually (comma or space separated). The wildcard syntax (/WEB-INF/applicationContext*.xml) doesn't work on OC4J. More details on the mailing list.

OC4J Installation

1. Download Oracle App Server 9.0.4.

2. Unzip the files to the path c:\oc4j-9.0.4

3. Complete the install with the commands:

  • c:
  • cd c:\oc4j-9.0.4\j2ee\home
  • java -jar oc4j.jar –install

4. Set the administrator password to: welcome

5. Run the App Server: java -jar oc4j.jar

6. Verify it's running by loading http://localhost:8888/index.html.

7. Stop the App Server: java -jar admin.jar ormi://localhost:23791 admin welcome -shutdown

Configure OC4J for AppFuse

1. Edit C:\oc4j-9.0.4\j2ee\home\config\applications.xml and add the following line:
<web-module id="appfuse" path="../../home/applications/appfuse.war" />
2. Comment out the line (Note this was the default in version 9.0.3) to force the use of principals.xml:
<!-- <jazn provider="XML" location="./jazn-data.xml"/> -->
3. Edit C:\oc4j-9.0.4\j2ee\home\config\http-web-site.xml and add the line:
<web-app application="default" name="appfuse" root="/appfuse" />
4. Edit C:\oc4j-9.0.4\j2ee\home\config\principals.xml and add the following to the <group> element:
<group name="tomcat">
  <description>tomcat grp</description>
<group name="admin">
  <description>admin grp</description>
Then add the following to the <users> element:
<user username="tomcat" password="536c0b339345616c1b33caf454454d8b8a190d6c" 
  <description>tomcat user</description>
  <group-membership group="tomcat" />
<user username="mraible" password="536c0b339345616c1b33caf454454d8b8a190d6c" 
  <description>The appfuse administrator</description>
  <group-membership group="admin" />
NOTE: This version is using an xml file, principals.xml, for user authentication.

5. Edit C:\oc4j-9.0.4\j2ee\home\config\data-sources.xml and add the following:

<data-source class="com.evermind.sql.DriverManagerDataSource"
  name="jdbc/appfuse" location="jdbc/appfuse" 
  username="root" password="" 
  inactivity-timeout="30" />

6. Copy C:\appfuse\lib\mysql-connector-java-3.0.9-stable\mysql-connector-java-3.0.9-stable-bin.jar to C:\oc4j-9.0.4\j2ee\home\applib.

Set Environment Variables

1. Create an environment variable ORACLE10_HOME with the value c:\oc4j-9.0.4

AppFuse Modifications

1. Add the a target to deploy to Oracle/Orion in build.xml (or course, you could also simply modify the existing deploy target):
<target name="deploy-oracle10" depends="package-web" 
    description="deploy war to /j2ee/home/applications under $ORACLE10_HOME">
    <echo>Copying ${webapp.dist}/${webapp.war} to </echo>
    <echo>  ${env.ORACLE10_HOME}/j2ee/home/applications/${webapp.name}.war</echo>
    <copy file="${webapp.dist}/${webapp.war}" 
2. Edit \appfuse\metadata\web\filter-mappings.xml and comment out all the filters except for the actionFilter:
These don't seem to work on Orion, that's why they're commented out.

3. Orion starts Servlets before Listeners, so LoginServlet.init() gets called before StartupListener.contextInitialized(). To fix that problem, you'll need to add code StartupListener.contextInitialized():

Map config = (HashMapctx.getAttribute(Constants.CONFIG);  // "appConfig"
if (config == null) { 
    log.info("Creating New Application Context conf Object");
    config = new HashMap()

And similarly in LoginServlet.init():

Map config = (HashMapctx.getAttribute(Constants.CONFIG);  // "appConfig"
if (config == null) { 
    log.info("Creating New Application Context conf Object");
    config = new HashMap()

This way it doesn’t matter who gets started 1st. The context will be initialized and added to. This works for Tomcat and Orion.

4. Orion doesn’t like Matt’s cool error page trick. Here’s how to get around it.

  • Edit metadata\web\web-security.xml
  • Create web\security\loginError.jsp containing:
<%@ include file="/common/taglibs.jsp"%>
<jsp:include page="/security/login.jsp" flush="true">
    <jsp:param name="error" value="true"/>
The latest code in CVS actually uses this strategy as its more portable. ~ Matt

Verify AppFuse Installation using Tomcat

* C:\mysql-4.0.17\bin\mysqld.exe --console        (start MySQL)
* ant setup-tomcat                                (Configure Tomcat)
* ant setup-db                                    (Configure MySQL)
* ant test-all                                    (Run all tests)
* ant test-reports                                (Generate Test Results)
* View C:\appfuse\build\test\reports\index.html   (Verify results)
* C:\jakarta-tomcat-5.0.16\bin\startup.bat        (start Tomcat)
* http://localhost:8080/appfuse                   (Verify Appfuse is running in Tomcat)
NOTE: Make sure C:\appfuse\lib\hibernate-2.1.1\lib\jta.jar is in C:\jakarta-tomcat-5.0.16\common\lib

Build for Oracle

1. Use ant to create a war and deploy it.
ant -Dhttp.port=8888 clean package-web
ant -Dhttp.port=8888 deploy-oracle10

You should see the following message:

Copying C:\appfuse/dist/webapps/appfuse-1.3.war to c:\oc4j-9.0.4/j2ee/home/applications/appfuse.war

NOTE: OC4J uses port 8888 by default. You can set this to be the default by defining an http.port=8888 property in build.properties, or changing the default in properties.xml.

Test with OC4J

1. Start the App Server (cd c:\oc4j-9.0.4\j2ee\home; java -jar oc4j.jar)
04/02/04 09:32:43  Auto-unpacking C:\oc4j-9.0.4\j2ee\home\applications\appfuse.war... done.
04/02/04 10:39:42 Auto-deploying appfuse (New server version detected)...
04/02/04 10:39:43 Oracle Application Server Containers for J2EE 10g ( initialized

2. Open page http://localhost:8888/appfuse and login with username/password tomcat/tomcat.


Modified the Eclipse Project, Properties, Java Build Path. A couple of Jars were incorrect. MyEclipse allows you to do source-level debugging under Tomcat and OC4J.

Differences between Tomcat and OC4J

These messages display when Tomcat is started, but don’t display under OC4J. This one is probably because I'm not using the database for authentication yet.
AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@137d4a4)
  LogAbandoned: true
  RemoveAbandoned: true
  RemoveAbandonedTimeout: 60
  NamingHelper.bind(68) | Creating subcontext: hibernate

OC4J Version 9.0.3 Notes

  • Copy the JDBC driver to C:\oc4j-9.0.3\j2ee\home\lib instead of C:\oc4j-9.0.4\j2ee\home\applib
  • rename C:\oc4j-9.0.3\jdk\lib\tools.jar tools.jar.old #obsolete jar file
  • copy C:\j2sdk1.4.2_03\lib\tools.jar to C:\oc4j-9.0.3\jdk\lib\tools.jar
  • rename C:\oc4j-9.0.3\j2ee\home\lib\jasper.zip jaspar.jar

oracleas.html Info on oracleas.html 24607 bytes

Go to top   Edit this page   More info...   Attach file...
This page last changed on 06-Nov-2006 13:52:58 MST by MattRaible.