Fixing a broken Eclipse

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.

I then ran Findbugs on Profile2 and it picked up some things that were silly (Unused fields when the field was actually used), so decided an update for Findbugs was in order. After it did it’s thing this time, and I restarted, I get a fatal error and it just shuts down. Great.
“The Eclipse executable launcher was unable to locate its companion shared library”
Considering this piece of software is essential for my work, it needed to be fixed. I wasn’t too keen on installing a completely new version and adding back in all my plugins.
I went hunting to find the cause.
Eclipse.app is actually a package, with the executable and configuration files inside it, and you can get to its guts by right-clicking/ctrl-clicking on /Applications/eclipse/Eclipse.app and choosing Show Package Contents.
Navigating into Contents/MacOS/ and you get the eclipse binary and the eclipse.ini config file. You can actually run the Eclipse app from here. So I tried that and got this:
/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse ; exit;
dlopen(../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.100.v20080509-1800, 2): image not found
I then opened eclipse.ini to see what was being loaded. Strangely enough, the same thing:
–launcher.library
../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.100.v20080509-1800
Navigating back to that path, ie /Applications/eclipse/plugins/… and having a look around, well, it was right, there was nothing at that location. There was however a similarly named folder, updated today. Conveniently coincidental?
I updated the path in eclipse.ini to be the updated one:
../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.101.R34x_v20080731
saved and launched the Eclipse binary again. Success!
Advertisements

Sakai with Java 6 and Tomcat 6

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!

Displaying XML in Safari

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!

Updating Maven on Mac OS X

>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 have been building Sakai 2.5 and upwards with Maven 2.0.9 since September 2008 without a hitch. I can’t remember the reason I upgraded but I think it was another bug I came across!
I have produced some notes below which will walk you through upgrading Maven on OS X.
1. Download Maven
2. Unpack the archive on your Desktop by double clicking it.
It will extract to a folder called maven-2.x.x (ie maven-2.0.9)
3. Open Terminal and issue the following commands:
sudo mv ~/Desktop/maven-2.0.9 /usr/local/
NOTE: If you cannot use sudo because of local restrictions you can install it locally, perhaps in your home directory somewhere. Just substitute the path you use in the following steps.
4. OPTIONAL. Update any symlink you might have to the new Maven directory:
cd /usr/local
sudo rm m2 (where m2 was my symlink m2 -> maven-2.0.6)
ln -s maven-2.0.9 m2
You now have a symlink m2 -> maven-2.0.9
5. ONLY REQUIRED IF YOU DO NOT USE SYMLINKS, ie step 4. Update your M2_HOME environment variable:
export M2_HOME=/usr/local/maven-2.0.9
If you use symlinks like /usr/local/m2 then your M2_HOME can point to /usr/local/m2 and you don’t need to change anything except the symlink in step 4.
6. Check your PATH
In order to use the correct version of Maven, check your path contains $M2_HOME/bin. Mine looks like:
PATH=$PATH:$MYSQL_HOME/bin:$M2_HOME/bin:/usr/local/bin:$HOME/bin
export PATH
and this is in .profile in my home directory.
7. Test:
mvn -v

Maven version: 2.0.9
Java version: 1.5.0_16
OS name: “mac os x” version: “10.5.6” arch: “i386” Family: “unix”
Done. Simple eh 🙂

Profile2 v1.1 released

>I am very pleased to announce the 1.1 release of Profile2 for Sakai.

Profile2 is a complete re-development of the existing Profile tool in Sakai and brings social networking to Sakai2. A Facebook-like interface for editing your profile, comprehensive privacy controls, post status updates including Twitter integration, searching for people with common interests and adding them as a connection, are what Profile2 is all about.
Over 23 fixes and new features are incorporated into this release including: improved Twitter integration, email and event publishing, full control over the configuration, improved AJAX processing, and full support for 2.4.x, 2.5.x and the 2.6.x releases of Sakai.
Your profile
Comprehensive privacy settings
Manage connections and connection requests
More information, including screenshots and installation instructions for all three Sakai flavours are available on Confluence here:
For the full list of features and fixes for the release, please see the issue Navigator for Profile2 in the Sakai Jira: