Fixing Tradebeans and Tradesoap on 64 bit JVMs

Edit: March 10, 2014: It seems this may not be the panacea I thought it is. Will update if I can figure out more on what's going on, but be aware for now: YMMV.


Imagine you're trying to run the tradebeans or tradesoap benchmarks from the Dacapo Benchmark suite with a 64 bit JVM.

If you, like me, just downloaded the dacapo-9.12-bach.jar you'll likely see a huge stack trace failure like the below:

java -jar dacapo-9.12-bach.jar tradesoap -t 1 
Using scaled threading model. 8 processors detected, 1 threads used to drive the workload, in a possible range of [1,128]
11:08:54,419 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: abstractName="org.apache.geronimo.framework/j2ee-system/2.1.4/car?ServiceModule=org.apache.geronimo.framework/j2ee-system/2.1.4/car,j2eeType=AttributeStore,name=AttributeManager"
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -2
    at com.sun.xml.bind.v2.util.CollisionCheckStack.findDuplicate(CollisionCheckStack.java:112)
    at com.sun.xml.bind.v2.util.CollisionCheckStack.push(CollisionCheckStack.java:53)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.pushObject(XMLSerializer.java:471)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:574)
org.apache.geronimo.gbean.InvalidConfigurationException: Configuration org.apache.geronimo.framework/j2ee-system/2.1.4/car failed to start due to the following reasons:
  The service ServiceModule=org.apache.geronimo.framework/j2ee-system/2.1.4/car,j2eeType=AttributeStore,name=AttributeManager did not start because Array index out of range: -1
  The service ServiceModule=org.apache.geronimo.framework/j2ee-system/2.1.4/car,j2eeType=ConfigurationManager,name=ConfigurationManager did not start because org.apache.geronimo.framework/j2ee-system/2.1.4/car?ServiceModule=org.apache.geronimo.framework/j2ee-system/2.1.4/car,j2eeType=AttributeStore,name=AttributeManager did not start.

    at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:485)

This bug report is the hint you need.

Essentially the report points out that jaxb fails on 64 bit systems because it indexes an array using a hash code which can be negative.

Following that report, you can get Tradebeans and Tradesoap working by replacing the jaxb jars inside the dacapo jar.

Because the aforementioned bug report specificaly points out that they resolved the problem with 2.1.13, I also used JAXB 2.1.13.

After you unzip the dacapo jar, you'll need to unzip dat/daytrader.zip as well. Inside of that, the files you'll replace are geronimo-jetty6-minimal-2.1.4/repository/com/sun/xml/bind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.jar, with the obtained jaxb-ri-20100511/lib/jaxb-impl.jar and ./repository/javax/xml/bind/jaxb-api/2.0/jaxb-api-2.0.jar with jaxb-ri-20100511/lib/jaxb-api.jar (keeping the same names)

Seems to work now!