Sunday, October 12, 2008

More fun with IBM JDK on AIX

An issue that tends to turn up with various projects using Java's security mechanism is that the IBM JDK uses a different set of security providers than the reference Sun SDK. You'll know that your project is hitting this issue when a security related test fails due to a provider not found error (or similar message), even though the same test case passes on other platforms.

The manual solution is to edit the file in $JAVA_HOME/jre/lib/security/ to contain the providers list in the order expected by Sun, however this may not be an option on your system (perhaps all java configuration files are locked down to read only permissions). In the case that you can't modify the file directly you'll have to specify an alternate properties file for the JVM to use. This is as simple as passing the following JVM parameter to your test case launcher "
", where is your updated file.

So how would one incorporate this into a maven based testing harness?

The below maven entry sets up a profile for IBM JDK and instructs the surefire test harness to use a provided properties file. Please note that only when an IBM JDK is detected will the new file be used.
<value>IBM Corporation</value>

You may have noticed something a little strange about the JVM parameter, the use of the double equality is intentional - if you use a single equals (=) then it appends your specified property file to the default property file, the double equality forces your specified configuration to be used.


No comments: