Thursday, January 20, 2005

Deploying Jetspeed-2 on JBoss 4.0.1, revisited...

My conclusion in my previous post, about the use of UseJBossWebLoader, I appeared to be wrong.
After that all kinds of, less obvious problems, occured.
Like deployment of portlets complaining with ClassNotFound exceptions for classes in their own jar file.
It appeared that after re-enabling that setting again, but removing the commons-logging-1.0.3.jar and log4j-1.2.8.jar files from the directory ../jetspeed.war/WEB-INF/lib, jBoss started without complaining, altough still showing portlets without a body.

The latter is because the JBossManager class, as defined in .../jetspeed.war/WEB-INF/assembly/jetspeed-spring.xml, is not implemented. It only contains stub implementations.

But thats for next time, now its skiing time...

Monday, January 10, 2005

Deploying Jetspeed-2 on JBoss 4.0.1

As stated in one of my previous posts, I need to get Jetspeed 2 running on JBoss 4.0.1 and connected to a MaxDB database.
In the previous post I showed how one can connect J2 to a MaxDB database server.
This post describes the results of my first, failed, attempt to deploy J2 on JBoss using that same MaxDB database.
I am using the M1 binary release package of Jetspeed 2, and most of the steps taken originate from J2,'s wiki.

First I have created a copy of the default jboss server and named it jetspeed.
To keep the jetspeed jar files seperated from JBoss's jars, I created a sub-directory named j2 in the lib directory, and added the following line to the jboss-service.xml:
 <classpath codebase="lib/j2" archives="*"/>
I added a datasource file named jetspeed-maxdb-ds.xml to the deploy directory, to allow jetspeed to connect to my maxdb database server:
<?xml version="1.0" encoding="UTF-8"?>

<!-- The MaxDB database JCA connection factory config for the Jetspeed database -->
To be able to use the datasource, the JDBC driver needs to be present on the server's classpath. Therefor I placed the sapdbc-7_6_00_00_3247.jar in the lib/j2 directory.

The binary M1 release contains a directory named shared/lib, I copied all jar files in that directory into the newly created lib/j2 directory.
The binary M1 release also has a directory named jetspeed. This dir contains the extracted contents of the war file.
I copied this directory completely into the deploy directory and renamed it to jetspeed.war.

By default J2 is configured to use the tomcat as application server, to change this into JBoss the file
needs to be editted.
So I commented out the
definition for Tomcat and uncommented the definition fo rJBoss.

After that I started JBoss...

The following is the first ERROR that popsup in the server log file:
2005-01-11 09:39:28,291 ERROR [org.apache.commons.modeler.BaseModelMBean] Error creating class org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log

This might show a potential class loading problem....

In the JBoss docs, chapter 9. Web Applications, I found the following:
This flag indicates that Tomcat should use a JBoss unified class loader as the web application class loader.
The default is true, which means that the classes inside of the WEB-INF/classes and WEB-INF/lib directories of the WAR file are incorporated into the default shared class loader repository described in Chapter 2, The JBoss JMX Microkernel.
This may not be what you want as its contrary to the default servlet class loading model and can result in sharing of classes/resources between web applications.
You can disable this by setting this attribute to false.
Setting this setting to false, solved a lot of the problems. Now J2/JBoss starts fine, but the portlets only show their titlebar and not the contents.

Running Jetspeed-2 using a MaxDB database

My professional goal for 2005 is to base the epoline portal on open source tools only.
The portal server framework is not chosen yet, altough it most likely will become jetspeed 2.
JBoss 4.0.1 will be used as application server, and MaxDB as database management system.

I have just succeeded to run Jetspeed-2 M1 using the MaxDB database.
First you need to setup 2 databases on MaxDB, a production database and a test database, the latter is used during compilation, when executing unit tests.

To allow the jetspeed 2 build process to create the database, you have to create or edit a file and add the following lines to it:

# -------------------------------------------------------------------------
# configure MaxDB Test DB
# -------------------------------------------------------------------------

# -------------------------------------------------------------------------
# configure MaxDB Production DB
# -------------------------------------------------------------------------

# -------------------------------------------------------------------------

Now when running maven allClean allBuild, the database will be created on MaxDB.

All we now need to do to access the MaxDB database from j2 running on tomcat, is change the connection settings in ${CATALINA_HOME}/conf/Catalina/localhost/jetspeed.xml.

The JBoss 4 Application Server Guide

The The JBoss 4 Application Server Guide is published for free.
This can be quite usefull during development.