I recently performed an update of a few items in Eclipse. The first was updating my version from 3.4.0 to 3.4.2 which I did by finding the Eclipse Platform entry in Software Updates > Installed Software, and clicking update. It checked a few dependencies, did its thing, restarted, all ok.
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:
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.
mvn clean install sakai:deploy
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:
mvn clean install sakai:deploy -Dsakai.app.server=tomcat6
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.
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!
Safari has been my browser of choice since forever simply because it’s super-fast. One thing that has annoyed me for a while though is that you can’t just view raw XML like you can in other browsers, without choosing ‘View Source’, or turning on the Web Inspector panel.
In developing some EntityBroker code, with XML as the output, I just get the content. Not too helpful. Fed up, I went searching for a solution, and found an excellent one called XML View Plugin: http://www.entropy.ch/software/macosx/xmlviewplugin/
It’s a plugin that you simply drop into Library > Internet Plug-Ins, restart Safari and can now view the raw XML on screen in all its syntax-coloured glory!
>After some issues on the mailing lists with Maven versions for building Sakai, it became apparent that upgrading Maven on OS X was difficult, which is why there was a requirement to support Maven 2.0.6 and implement workarounds for it’s bugs which have been fixed in more recent versions.
>I am very pleased to announce the 1.1 release of Profile2 for Sakai.