OpenCMS and OC4J 10.1.2 (part 2)

Trying to get OpenCMS working with OC4J 10.1.2 (or 10.1.3 dp4) seems to be quite challenging task. What makes this very interesting is that I don't seem to get any errors or exception messages in any of the logs despite of enabling full debugging in log4j.properties file.

There were definitely something wrong with the installation of OpenCMS on OC4J. The installation failed on NPE but system somehow managed to start up. Perhaps some of the modules got installed correctly. I can see that some of the config files point to Tomcat setup (like pointing to ROOT -default web application), so there might be something Tomcat specific behind the scenes that affect the application execution on other containers.

Anyways, to fork the problem area I installed OpenCMS using Tomcat (which works fine) so that I got the repository installed correctly on my Oracle 10.1.3 database. What I did then was I copied all the OpenCMS config etc. files under Tomcat webapps to the OC4J directory to make sure everything is as it should be after the installation. What happens is that systems starts up nicely, the log file compared to Tomcat looks exactly the same (used UltraEdit file diff'er to find out the differences). But what happens next after entering login (Admin/admin), is not something I am looking for. The login screen keeps popping up all the times and the workspace isn't shown. No error messages, no exceptions, no beeps, no nothing.

One step closer to despairness was when I downloaded the whole OpenCMS sources tree on my JDeveloper and re-built the whole application from sources. Now the only thing to find out was to remotely debug the OpenCMS server using JDeveloper's remote debugger and starting OC4J in debugging mode. Ok. This should work... or should it? I set the debug break point and debug the application line-by-line. For some reason the debugger freaks out in the critical moments that should point out the problem area. What is going on?

I also see that other people face the same problem when looking at OpenCMS mailing list.

Battle continues. Having the sources and detail debugging should eventually reveal the source of the problem. Let's see how long this takes.


OpenCMS and OC4J 10.1.2

For those that want to get OpenCMS working with OC4J here is an important note. The OpenCMS installer uses Java threads when setting up the modules. If you don't have user threads enabled in OC4J, you will face errors like "Unable to read opencms xml configuration". To work around this, you have to enable background threads for the container and this you do by adding following parameter to the OC4J container startup:

So if you start the OC4J from command line: java -jar oc4j.jar, you need to start with java -Doc4j.userThreads=true -jar oc4j.jar.
After this you will be able to run the setup successfully and continue using OpenCMS.

Re-packagaging EAR

For those that need helping hand on the re-wrapping the OpenCMS war file to be deployed as EAR in OC4J here are the steps:
1. Create a new subdirectory
2. Copy the opencms.war file to that directory
3. Create META-INF -directory and new file application.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

4. Package EAR file: jar cvf opencms.ear *


For deployment I usually use a script that uses admin.jar. Here is a sample I use on Windows:

set OC4JDIR=D:\apps\oc4j_extended_101202\j2ee\home
set FILEE=%1%
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -undeploy %FILEE%
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -deploy -deploymentName %FILEE% -file %FILEE%.ear
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -bindWebApp %FILEE% %FILEE% http-web-site %FILEE%

For Linux you need to figure out yourself how to replace the variable names in Unix style ;)

Login Problems

In the end of the installation I still faced some NPE exceptions, looks like they were related somehow to user management.
Once I re-started the instance I got following errors in the opencms.log:
19 Oct 2005 06:59:21,578 ERROR [ org.opencms.main.OpenCmsCore: 296] Critical error during OpenCms initialization: The OpenCms setup wizard is still enabled.

This can be fixed by setting the setup wizard setting to false in opencms.properties -file.

Once trying to open up the admin workspace using URL: http://localhost:8888/opencms/opencms/system/login, I will get the login dialog where I enter the default Admin username and password. From the log files seems like I get successful authentication but the workspace never shows up. The login dialog will always be shown to user. Seems like browser type (IE, TB) doesn't have anything to do with this.

The login problem is still to be resolved until OpenCMS can be successfully used with OC4J.

I'll be back.