My Oracle and Solaris Experience Overview

This post is to be updated as I dig out more of my original notes and bookmarks. It was written for an overview document to be handed to the next person handling the Oracle project:

The Oracle ADF development guide gives a good overview of the entire Application Development Framework as provided by Oracle and is targeted at Oracle 10g. There is a short presentation on ADF available.
Migration to Oracle from Access is best done using the ODBC connection to Oracle and standard SQL commands. There are other alternatives but most migration tools didn’t work properly or were expensive. Some of the tools tried include Oracle SQL Developer, EMS Data import, Apatar, Oracle Migration Workbench (see this forum thread).

The installation process of Oracle on Solaris took some time to get to work but despite a few typos this guide is the best source of information on Oracle installation. More information is available here but this is a slightly different installation method. My blog at http://blog.jamesrossiter.co.uk has some of the steps I took to install Oracle as well as a few of the pitfalls in the documentation to watch out for.
There is some slightly outdated info on Oracle’s built in http server here and here which helped explain a few of the different components Oracle needs for http.

The Oracle web server of choice is OC4J, Oracle Containers for Java. The most useful tutorials for working with JDeveloper and OC4J were on deployment of applications as well as this, the most important tutorial in this list on JSF, EJB and Oracle’s preferred way of writing web apps with JDeveloper. OC4J is based on Apache and must be installed separately to Oracle. A cut down old version of OC4J is included with Oracle 10g but this is not to be used to develop apps. A lot of the documentation is confusing on this but after checking the forums it appears you need to install a standalone OC4J instance or install the Oracle Application Server. I installed the standalone OC4J as it seems much easier to use and the documentation I found is mainly focused on the standalone version.

I had a look at Oracle htmlDB, which has been updated and is now called Apex (Oracle Application Express). This is supposed to be a very quick way of prototyping database driven applications, see this unofficial overview. There is an unofficial wiki for Apex. I got Apex to work but the amount of flexibility provided was not enough and I was concerned that we would outgrow the abilities of Apex when writing custom apps.

The best way to write online apps looks to be the ADF way of doing things with Jdeveloper, Oracle 10g (or 11) and OC4J. For this you need to know Enterprise Java Beans, Java Server Faces and how to use Jdeveloper to deploy your applications to OC4J. I had problems deploying applications to my Solaris install of OC4J using Jdeveloper but have tested several small apps based on the tutorial (in bold above) using the built in OC4J server in Jdeveloper. My forum posts with the problems I faced following the deployment tutorial are here and here but I still didn’t manage to solve the problem. There is a third party forum devoted to developing for Oracle.

The key to Jdeveloper web application creation is Master-Detail relationships, made possible through foreign key relationships in the Oracle database and automatic object creation using Java Beans. Master-Detail relationships can be easily visualised using the templates available in Oracle ADF Server Faces (a more Oracle focused version of Java Server Faces) and there are plenty of tutorials available from Oracle like those in the official documentation.

Running Web Applications on Oracle OC4J and Solaris

I reached the stage where I can deploy the example web application from Oracle on my own standalone Oracle Containers for Java EE (OC4J) installation running on Solaris. There were a couple of hurdles before I got this far, one of which is a known bug with the Oracle Application Development Framework (ADF). Now that my Solaris install is set up I should be able to deploy applications written on my local machine (a Windows XP install) to my OC4J server using Oracle Jdeveloper.

First up I downloaded the latest version of the OC4J standalone install and extracted it to “/export/home/OC4J”. I set the “J2EE_HOME” environment variable to “/export/home/OC4J/j2ee/home” and made sure “JAVA_HOME” was set to “/usr/java”.

Next I tested the install by downloading the “Hello World” .jsp page from Oracle. After making sure this was working ok by placing it in “/export/home/OC4J/j2ee/home/default-web-app” and going to “http://serveraddress:8888/helloworld.jsp” I was ready to try installing an actual web application.

I followed the instructions from Oracle for deploying a web application. In short this requires you to enable the “oe” user in Oracle, set up a connection to your Oracle database and OC4J server in Oracle Jdeveloper and set up deployment projects for the example web application. This is all covered in the tutorial.

I tested the application on my local machine where it worked fine so I thought it could easily be deployed. I clicked “Deploy to OC4J” on the “OrderEntryApplication.deploy” .EAR file and the deployment failed. I tried using the web interface at “http://serveraddress:8888/em” to deploy the .EAR file manually and got the same error (sorry I didn’t record exactly what it was).

Next up I googled and found that you need the Oracle ADF installed on your OC4J server in order to run web applications. It isn’t installed by default in the OC4J standalone install so you need to install it manually. I read a few forum posts that said you could install ADF by just copying some .jar files across to your OC4J install but decided to do it the “proper” way as suggested by Oracle. I installed Jdeveloper on my Solaris box by downloading it and extracting to “/export/home/jdevstudiobase10134″ then started it by running “/export/home/jdevstudiobase10134/jdev/bin”. I shut down my OC4J server first as required and clicked “tools -> ADF Runtime Installer -> Standalone OC4J…” in Jdeveloper and went through the wizard to install the ADF runtime components.

This should have been fine but when I went to start the OC4J server up again I got an error:

Error initializing server: Shared library “oracle.ws.jaxrpc” could not be found.

According to this forum post this is a bug and the workaround has even been included in the 10.1.3.x release notes addendum. To fix it you need to go into your “J2EE_HOME/config/server.xml” and remove the two references to the offending library by deleting this line twice:

<import-shared-library name=”oracle.ws.jaxrpc”/>

Now when you start up the OC4J server again it will start and you can visit your web application. One final thing, if following the tutorial make sure you visit “http://servername:8888/OrderEntry/faces/index.jsp”. I missed out the “/faces/index.jsp”, if you miss out the “faces” you get a server 500 error (the server doesnt know to use Java Server Faces) and if you miss out the “index.jsp” the link on the first page doesnt go anywhere!

Next step is to write a custom application to display, edit and add data in an Oracle database schema. I will be using Enterprise Java Beans for data objects and Java Server Faces for the front end on top of JSP. Still a fair way to go but at least now we can create and deploy applications using Oracle Jdeveloper.