Sunday, July 10, 2011

Trying out JDK7 with Apache Karaf

Java early access builds of JDK7 are now available for download, as such I thought I would get a copy and take it out for a test drive.

The Environment


Setting Up

The base Ubuntu setup took only a few minutes to provision. Installation of subversion was straight forward via apt-get, and the Maven binary a simple tar xzf filename. The JDK7 binary snapshot is delivered as tar.gz file, so it too was a simple matter to decompress and extract. To simplify my test environment I wrote a very short setup script to source my tool chain:

MVN_HOME=/x1/apache-maven-3.0.3
JAVA_HOME=/x1/jdk1.7.0
export MVN_HOME JAVA_HOME
PATH=$JAVA_HOME/bin:$MVN_HOME/bin:$PATH
export PATH

Testing the tool chain we see the following from passing version to maven:

jgoodyear@LinuxJDK7:/x1$ mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 14:01:09-0330)
Maven home: /x1/apache-maven-3.0.3
Java version: 1.7.0, vendor: Oracle Corporation
Java home: /x1/jdk1.7.0/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "2.6.38-8-generic", arch: "amd64", family: "unix"

Once subversion was present I checked out the latest code from trunk, and was ready to start testing out the new JDK.

Test drive begins!

Starting from a clean slate I executed mvn clean install in trunk, and watched while maven took over and started downloading all the dependencies and resources it required. Once maven was satisfied it started in compiling Karaf, module by module. 

The first snag encountered during the JDK7 build was with the Karaf JAAS module. The Felix Properties call get (key) and keySet now both require explicit type casting on their return values. A few simple casts, and we were back in business.

More explicit casting was required in Karaf Admin Core and Karaf Maven Plugin. Correcting these minor issues Karaf was able to completely build.

Unfortunately many of the integration tests fail. I suspect some failures are due to new security provider configurations, while others are due to dependencies not being fully JDK7 compliant at this point in time.

Trying a JDK7 built kit out...

Continuing on, I tried out the Karaf kit produced by the build attempt. The issues encountered above however prevented Karaf from fully starting. It appears that we'll be working towards a stable JDK7 build of Apache Karaf for the next while. On the bright side of things most of the Karaf code base is now compiling under JDK7, so our efforts here will probably shift towards assisting the underlying projects to become JDK7 compliant then return to Karaf to see how they integrate into the whole.

No comments: