Deploying ADF Application to Standalone OC4J

For the deployment of an ADF Application to my standalone OC4J I’ve faced some problems which aren’t clearly explained/solved on OTN.
You will find many people facing the same problems when deploying applications to OC4J from jboException until Log4j-exceptions, etc.

I will try to address some of these problems in this blog using my own project deployed to a standalone OC4J.

Following errors/problems cam uping during deployment:

  • java.lang.NoClassDefFoundError: oracle/jbo/JboException
  • java.lang.NoClassDefFoundError: org/apache/log4j/Category
  • Problems with shared libraries and user-libraries when deploying from JDeveloper-IDE
  • Memory problems during deployment

How were this problems addressed and how did I package the application?

In my J2EE application the following technologies are being used: Toplink, EJB 3.0, OCS and finally ADF Faces as the frontend. Additional libraries we’re using: log4j-libraries.

This J2EE application uses the MVC-paradigm which means i’m working with 3 important layers: Model, View and Controller. In my case the Model is written in Toplink, the DataControl which is the glue between the Model and View is based on the EJB 3.0 (sessionbeans) and in the end we which faces for our Controller.

How did I package this application, by the creation of deployment profiles for each application that’s used in the application:

  • A jar-file for the Toplink-model and bizzlogic-model
  • An ejb-jar file for the EJB-project(s)
  • A war-file containing all logic of the view-layer (jspx, images, pageDefinitions, backing beans, web.xml file, jazn-data file, orion-application.xml file, etc.
  • An ear-file packaging all the different deployment profiles together using the Application Assembly tool

As I mentioned before i’m using log4j in the application and I experienced a lot of problems during deployment because a newer version of log4j is used in our application, than the one which is used by default by OC4J. How can you solve this problem:

  • Add the version you’re using in your project (log4j-1.2.13.jar) and the commons-logging jars from JDeveloper to the EAR file and point towards these 2 jar-files in the MANIFEST.MF file from the project that uses log4j

Secondly I mentioned Toplink is used for the Model-layer for which we needed to perform a manual configuration as well:

  • Copy xdb.jar from the toplink workbench folder to the directory of the standalone OC4J installation \toplink\jlib\xdb.jar

To address the jboException you need to install the ADF Runtime Installer to your standalone container. You can do this using the JDeveloper IDE, first create an Application Server Connection to your standalone OC4J. Go to the menu ‘Tools’, choose the ‘ADF Runtime Installer’ and choose to deploy to ‘standalone OC4J’.

Make sure your OC4J isn’t running when you perform this task because otherwise all libraries can’t be upgraded because they’re being used by the container.

Last but not least the ‘OutOfMemoryException’/PermGen Space can be adressed by adding memory to your standalone OC4J or IAS. For OC4J you could add the following attribute to the oc4J.cmd-file which can be found in the bin-folder of your oc4J_home => add the following:

OC4J_JVM_ARGS=-XX:PermSize=128m -XX:MaxPermSize=256m

If you need an indepth explanation about memory-management you can view the Memory Management topic on this blog.

Have fun!