| At line 1 added 207 lines. |
| !!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|oracleas.html] 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 (10.1.2.0.2), see [AppFuseOnOracleAS10g]. |
|
| %%note __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|https://appfuse.dev.java.net/servlets/ReadMsg?list=issues&msgNo=414].%% |
|
| !!OC4J Installation |
| 1. [Download|http://otn.oracle.com/software/products/ias/index.html] Oracle App Server 9.0.4. |
| * Choose Production Software |
| * Choose OracleAS J2EE Downloads, Pure Java release. |
| * Choose [Oracle Application Server Containers for J2EE 10g (OC4J)|http://download.oracle.com/otn/java/oc4j/904/oc4j_extended.zip] build# 031125 |
|
| 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> |
| <group name="admin"> |
| <description>admin grp</description> |
| </group> |
| }}} |
| Then add the following to the <users> element: |
| {{{ |
| <user username="tomcat" password="536c0b339345616c1b33caf454454d8b8a190d6c" |
| deactivated="false"> |
| <description>tomcat user</description> |
| <group-membership group="tomcat" /> |
| </user> |
| <user username="mraible" password="536c0b339345616c1b33caf454454d8b8a190d6c" |
| deactivated="false"> |
| <description>The appfuse administrator</description> |
| <group-membership group="admin" /> |
| </user> |
| }}} |
|
| ;:__''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" |
| connection-driver="com.mysql.jdbc.Driver" |
| username="root" password="" |
| url="jdbc:mysql://localhost/appfuse" |
| 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}" |
| tofile="${env.ORACLE10_HOME}/j2ee/home/applications/${webapp.name}.war"/> |
| </target> |
| }}} |
| 2. Edit __\appfuse\metadata\web\filter-mappings.xml__ and comment out all the filters __except for__ the ''actionFilter'': |
| {{{ |
| <filter-mapping> |
| <filter-name>actionFilter</filter-name> |
| <url-pattern>*.do</url-pattern> |
| </filter-mapping> |
| }}} |
| ;:''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(): |
|
| [{Java2HtmlPlugin |
|
| Map config = (HashMap) ctx.getAttribute(Constants.CONFIG); // "appConfig" |
| if (config == null) { |
| log.info("Creating New Application Context conf Object"); |
| config = new HashMap(); |
| } |
| }] |
|
| And similarly in LoginServlet.init(): |
|
| [{Java2HtmlPlugin |
|
| Map config = (HashMap) ctx.getAttribute(Constants.CONFIG); // "appConfig" |
| if (config == null) { |
| log.info("Creating New Application Context conf Object"); |
| config = new HashMap(); |
| } |
| }] |
|
| This way it doesnt matter who gets started 1st. The context will be initialized and added to. This works for Tomcat and Orion.\\ |
|
| 4. Orion doesnt like Matts cool error page trick. Heres how to get around it. |
| |
| * Edit metadata\web\web-security.xml |
| %%(margin-left: 40px) |
| {{{<form-error-page>/security/loginError.jsp</form-error-page>}}}%% |
|
| * Create web\security\loginError.jsp containing: |
| %%(margin-left: 40px) |
| {{{<%@ include file="/common/taglibs.jsp"%> |
| <jsp:include page="/security/login.jsp" flush="true"> |
| <jsp:param name="error" value="true"/> |
| </jsp:include> |
| }}}%% |
|
| ;:''The latest code in CVS actually uses this strategy as its more portable. ~ [Matt|MattRaible]'' |
|
| !!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 (9.0.4.0.0) initialized |
| }}} |
|
| 2. Open page [http://localhost:8888/appfuse] and login with username/password __tomcat/tomcat__. |
|
| !!Eclipse |
| Modified the Eclipse Project, Properties, Java Build Path. A couple of Jars were incorrect. [MyEclipse|http://myeclipseide.com] allows you to do source-level debugging under Tomcat and OC4J. |
|
| !!Differences between Tomcat and OC4J |
| These messages display when Tomcat is started, but dont 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 |
|
| !!Useful Links |
| * [The Oracle FAQ|http://www.orafaq.com/] |
| * C:\oc4j-9.0.4\j2ee\home\default-web-app\standaloneguide.pdf |
| * [http://www.orionserver.com] |
| * [http://www.oracle.com/appserver/] |
| * [Webtest Support for Ant 1.6|http://lists.canoo.com/pipermail/webtest/2004q1/001389.html] |
| * [http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuseOnResin] |
| * [http://orionsupport.com/archive/articles/datasourceusermanager.html] |