Sunday, November 16, 2003


AXIS and OC4J/OracleAS

Thought the OC4J JAX-RPC note from last night night be interesting to folks checking out OC4J's built in Web services engine especially since it is fully buzzword compliant showing off J2EE 1.4, JAX-RPC and JSR 109 amongst others.

Equally interesting for many users of OC4J is how to get third party software like Struts, WebWork, Cocoon and, often posed to me in the Web services space, how to run AXIS on OC4J.

This entry goes through the basics of getting it going on a stand-alone OC4J - remember you are on your own here from a support perspective, but the support from the Apache groups is pretty solid and we do our best effort via the OTN forums: 

AXIS Server Set Up

1.  Download the binary - http://ws.apache.org/axis/download.cgi

2. Unzip into a working directory, let's call it <AXIS_WORKING>

3. Copy the directory <AXIS_WORKING>\webapps\axis and all its contents to your stand-alone OC4J directory structure - for this, I chose to put it in <OC4J_HOME> - the location of where you have OC4J installed (for this example, using Windows XP, I have OC4J installed in c:oc4j904).  My resulting directory structure/content looks like c:oc4j904\axis\happyaxis.jsp ..., c:\oc4j904\axis\WEB-INF\...

Side note: I am using  OC4J 904  for this rather than production OC4J 903.  I am also using JDK 1.4.1_05.

4. Shut down your OC4J and edit the configuration:

a. Edit the <OC4J_HOME>\j2ee\home\config\application.xml and add the line:

<web-module id="axis" path="../../../axis" />

Note if you copied the "axis" directory somewhere else than noted in step 2, modify the path above accordingly.

b. Edit the file <OC4J_HOME>\j2ee\home\config\http-web-site.xml and add the line:

<web-app application="default" name="axis" root="/axis" />

At this stage AXIS is set up and ready to go.  If you have read the installation guide  you are ready to do the installation testing by starting OC4J back up (e.g. in the <OC4J_HOME>\j2ee\home directory, running <jdk_home>\bin\java -jar oc4j.jar) and running the tests in the guide - replacing all the localhost:8080 to localhost:8888. 

So for example, if you go to the URL http://localhost:8888/axis/ you should get the main AXIS page and if you go to http://localhost:8888/axis/happyaxis.jsp  you should see that AXIS reports it is pretty well configured.

AXIS Testing

Of course you probably actually want to use it, so the next step is to set up a couple of scripts as described in the installation documentation but taking into account the tweaks you did for OC4J.

1. Create a script file setting an environment variable to your AXIS libraries. Here is mine from Windows XP - change it according to your platform and directory structure:

set OC4J_HOME=c:\oc4j904
set AXISHOME=c:\oc4j904\axis
set AXISCLASSPATH=%AXISHOME%\axis.jar;%AXISHOME%\axis-ant.jar;%AXISHOME%\jaxrpc.jar;%AXISHOME%\commons-discovery.jar;%AXISHOME%\commons-logging.jar;%AXISHOME%\log4j-1.2.8.jar;%AXISHOME%\saaj.jar;%AXISHOME%\wsdl4j.jar


If you are following the AXIS setup instructions, this is the same classpath set up as its deployment instructions with the extra OC4J stuff

2. Now go back to your AXIS distribution in the <AXIS_WORKING> directory.  Let's configure the stock quote example by changing into the directory <AXIS_WORKING>\samples\stock and running the command:

java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient -lhttp://localhost:8888/axis/services/AdminService deploy.wsdd

 Note the stockquote classes already are deployed in the <OC4J_HOME>\axisWEB-INF\classes directory, in case you are wondering - this command did not do the work, it only deployed the configuration.

Check out the readme in the sample/stock directory for how this Web service works.

3. You may want to go out and check that it was registered successfully on the server so go to the managment interface:

http://localhost:8888/axis/servlet/AxisServlet

and see if you stock service and WSDL are identified there.

4. Assuming that worked fine, you are ready to run the stock sample Web service client.  Before doing this, change directory to the root of your Axis distribution as the classpath used to run the client starts from there:

cd <AXIS_WORKING>
java -cp .;%AXISCLASSPATH% samples.stock.GetQuote -lhttp://localhost:8888/axis/servlet/AxisServlet -uuser1 -wpass1 ORCL

Note, again, the only difference from the standard AXIS instructions, is the port upon which the Web server receives the request.  For more on AXIS, refer to the trusty, well-written user guide and explore the samples directory, applying the same tweaks outlined above.

It's nice when 3rd party software generally just seems to work on OC4J.  If you think about it, it makes for an interesting product development problem for OC4J.  We first want to provide a fully integrated product out-of-the-box and simultaneously we want to make sure folks can successfully run 3rd party software on the platform. Ideally, we want to also give the flexibility to perhaps replace, upgrade or run multiple versions of components side by side.

Bottom line for this in the Java world often comes down classloading issues.  If you want some serious reading about the classloading problem domain, OC4J and how things work under the covers, check out this white paper by Bryan Atsatt and Debu Panda.  Interesting work happening in this space as we go forward in the 10g era.

Update: Deploying AXIS on Oracle9iAS 9.0.3
January 2004

Just an update as the obvious follow on is how do you do it on a full install of Oracle9iAS/OracleAS.  I have updated the instructions below for 9.0.3 because I am in the midst of setting up my new Linux desktop and haven't re-installed OracleAS 9.0.4 but have  a 9.0.3 on Windows handy.

AXIS Server Set Up on Oracle9iAS 9.0.3

1.  Download the binary - http://ws.apache.org/axis/download.cgi

2. Unzip into a working directory, let's call it <AXIS_WORKING>

3. Copy the directory <AXIS_WORKING>\webapps\axis and all its contents to your Oracle Application Server home directory structure - for this, I chose to put it in <ORACLEAS_HOME> - the location of where you have OracleAS installed (for this example, using Windows XP, I have OracleAS installed in c:\oracle\ora903).  My resulting directory structure/content looks like c:\oracle\ora903\axis\happyaxis.jsp ..., c:\oracle\ora903\axis\WEB-INF\...

Note: I am using Oracle9iAS 9.0.3 for this with the out-of-the-box JDK 1.3.1.

4. Shut down your Oracle9iAS 9.0.3 (e.g. <OracleAS_Home>\opmn\bin\opmnctl stopall) and edit the following configurations:

a. Edit the <ORACLEAS_HOME>\j2ee\home\config\application.xml and add the line:

<web-module id="axis" path="../../../axis" />

Note if you copied the "axis" directory somewhere else than noted in step 2, modify the path above accordingly.

b. Edit the file <ORACLEAS_HOME>\j2ee\home\config\default-web-site.xml and add the line:

<default-web-app application="default" name="axis" root="/axis" />

Note this is different than the stand-alone OC4J which defaults to using http-web-site.xml.  You can check what web-site.xml your server is using by looking in <ORACLEAS_HOME>\j2ee\home\config\server.xml and seeing what is pointed at.  In my install OracleAS pointed at default-web-site.xml.

c. Edit mod_oc4j.conf (e.g. DCM, EM, manually)(ORACLEAS_HOME>\Apache\Apache\conf\mod_oc4j.conf) add the following line:

Oc4jMount /axis/*

d. At this stage AXIS is set up and ready to go.  If you have read the installation guide  you are ready to do the installation testing by starting OracleAS back up (e.g.  <OracleAS_Home>\opmn\bin\opmnctl startall))and running the tests in the guide - replacing all the localhost:8080 to <your_,machine>:7777. 

So for example, if you go to the URL http://<your_machine>:7777/axis/index.html you should get the main AXIS page and if you go to http://<;your_machine>:7777/axis/happyaxis.jsp  you should see that AXIS reports it is pretty well configured.

AXIS Testing with Oracle9iAS 9.0.3

The same instructions in the previous OC4J AXIS Testing section should work with the following changes:

1. Replace all references to "c:\oc4j904" to c:\oracle\ora903 (or your <OracleAS_Home>

2. Replace all references to localhost:8888 with <your_machine>:7777 or whatever port your HTTP server on Oracle9iAS is listening on.



comment []
9:56:26 PM