Building and deploying Sakai with Java 6 and Tomcat 6 has been on my list of things to do for a while. I finally got around to it and here’s my findings.
First, how to switch Java versions on a Mac
You’ll need a 64bit Mac running OS 10.5 (Leopard) and should have recently run Software Update to get it automatically installed.
Open Applications > Utilities > Java > Java Preferences and in Java application versions drag Java SE 6 to the top. Assuming your JAVA_HOME environment variable points to /Library/Java/Home then that is all you need to do. To confirm, open Terminal and type:
java -version
You should get something similar to the following:
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
Building Sakai with Java 6 and Tomcat 5.5
You don’t need to do anything special to build Sakai with Java 6. Maven uses the JAVA_HOME property, and this now points to your Java 6 installation. Since you are still using Tomcat 5.5, nothing changed there either.
For more accurate results I first deleted my ~/.m2/org/sakaiproject/ directory to clear it of the artifacts built against Java 5.
Build command:
mvn clean install sakai:deploy
Results:
Sakai version |
build |
deploy |
startup |
testing* |
cafe-2.5.x |
success |
success |
success |
success |
2.6.x |
success |
success |
success |
success |
Building Sakai with Java 6 and Tomcat 6
The structure of Tomcat 6 has changed since Tomcat 5.5. The common, shared and server directories are flattened into a single directory ‘lib’. So all jars need to be deployed into that location.
To deploy to Tomcat 6 you need an additional flag for Maven:
-Dsakai.app.server=tomcat6
Build command:
mvn clean install sakai:deploy -Dsakai.app.server=tomcat6
Sakai version |
build |
deploy |
startup |
testing* |
cafe-2.5.x |
success |
partial |
success |
success |
2.6.x |
success |
partial |
success |
success |
The partial results in the deploy were that most jars were deployed into lib only, except some were still deployed to common/lib and shared/lib. Starting up Tomcat with these left in those locations caused failures on every webapp.

In this image you can see the artifacts that were deployed to common/lib and shared/lib. I moved them into lib manually and Tomcat started normally.
Errors:
Watching the logs I found one common stacktrace:
caused by: java.lang.NoClassDefFoundError: org/apache/commons/el/Logger
I went searching and noticed that no commons-el.jar was available anywhere (which contains the missing class). I compared this to my Tomcat 5.5 deployment and it was in common/lib. I added this to the Tomcat6 lib/ and restarted. Success! Once the classes were all moved into lib/ and the missing jar added, everything seemed to worked fine*. I’d really like to get some feedback on other people’s experiences regarding this so post some comments.
Disclaimer: testing* consisted of verifying the portal works, creating an account, logging in, uploading some resources, filling out my profile, creating a site, editing the wiki, posting a chat message and just general navigating around. It was by no means exhaustive!
Like this:
Like Loading...