Thursday, 11 February 2010

When Two Worlds Collide - IBM WebSphere on Ubuntu

Following the shining example of one of my Hursley colleagues, Ben Fletcher, I've recently been using WebSphere Portal 6.1.5 on Ubuntu 9.10 ( Karmic Koala ) on a relatively old Thinkpad T60p.

***Caveat***

This is almost certainly NOT NOT NOT supported by IBM, so be warned :-)

The initial installation of WebSphere Portal Express was troublesome, in that the installer kept failing, with the error: -

/opt/IBM/WebSphere/PortalExpress/AppServer/bin/wsadmin.sh: 116: Bad substitution
which baffled me, until I read Graham Buckell's excellent blog posting here: -

http://www.torkwrench.com/2009/05/04/getting-websphere-portal-to-install-on-ubuntu/

which documents how to change the default shell from dash to bash e.g.

cd /bin
unlink sh
ln -s /bin/bash sh

At this point, I kicked myself because I'd had a similar problem with Tivoli Directory Integrator on Karmic, which I fixed and blogged about a while back: -

http://www.davehay.f2s.com/2009/12/shelling-out-on-ubuntu-910-karmic-koala.html
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-SR2-linux-gtk.tar.gz
Once I "cracked" this, I was off and running - only to run into a wall with WebSphere Portlet Factory Designer 6.1.5.

Again, the "Blogosphere" came to my rescue, with a pair of excellent articles from Ben: -

http://benfletcher.wordpress.com/2010/01/02/websphere-portlet-factory-6-1-5-on-64-bit-ubuntu-9-10/

http://benfletcher.wordpress.com/2010/01/03/iwidgets-on-ibm-mashup-center-via-websphere-portlet-factory

In essence, I downloaded and installed a nice shiny new copy of Eclipse 3.4.2 ( eclipse-jee-ganymede-SR2-linux-gtk.tar.gz ) from here: -

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-SR2-linux-gtk.tar.gz

and expanded the TAR file ( tar xvzf ) to /usr/share ( thus creating /usr/share/eclipse ).

I then created a symbolic link to the Eclipse binary: -

cd /usr/bin
ln -s /usr/share/eclipse/eclipse .

I then ran the WebSphere Portlet Factory Designer installer, and dropped the WPF binaries into /opt/IBM/WebSphere/PortletFactory/Designer, and "told" the installer where to find Eclipse ( /usr/share/eclipse ).

However, it may have been my "faffing about" but Eclipse still didn't include the WPFD elements when I started it, so I had to perform some more "magic", by clicking Help -> Software Updates -> Add Site and add /opt/IBM/WebSphere/PortletFactory/Designer/eclipse as an installation location.

I'll add some screenshots of this later, but this allowed me to add the WPF features into Eclipse and, after a restart ( of Eclipse, not Ubuntu ! ), I was able to create a WPF project.

However, it was Ben's extra secrets that helped make this totally work: -

a) Adding the line: -

-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner

to: -

/usr/share/eclipse/eclipse.ini

to give me: -

-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner

These effectively set run-time options, and the XULRunner "hack" avoids fatal messages such as: -

java.lang.RuntimeException: Widget disposed too early!

which is a pain.

b) Changing the way that Eclipse launches popup windows to use the older GTK method; this was achieved by "hacking" the environment via a shell script to start Eclipse: -

export GDK_NATIVE_WINDOWS=1
/usr/bin/eclipse

This allows Eclipse to launch windows of its own; without this, you'll find that certain processes will never complete, as the pop-up windows never show up.

So, that's it, we're mostly done.

One thing that did confuse me - I run WebSphere Portal as a root user ( via the sudo su command ), and was running Eclipse as my normal non-root user. This meant that, whilst I could create portlet projects, I couldn't deploy them to WebSphere Portal, and was seeing messages such as: -

creation was not successful for an unknown reason

Once I ran Eclipse as root, all was well.

Footnote: A chap called Curran ( who's based 10 minutes down the road from where I currently sit in Littleton, MA ) has blogged more about Eclipse in Ubuntu here: -

http://lifeofaprogrammergeek.blogspot.com/2008/04/eclipse-java-development-in-ubuntu.html

and has written a script which appears to allow me to start Eclipse as my normal non-root user, but use sudo to allow the Eclipse processes to run as root, which is far more elegant than my approach.

Will try it and report back ...

No comments: