Menu

#97 Callback operations use benchmark's context class loader

open
nobody
Harness (16)
5
2012-09-10
2012-09-10
No

Running xalan with the XmlSummaryCallback developed for by the Scala Benchmarking Project results (on "Java(TM) SE Runtime Environment (build 1.6.0_26-b03)") in the following exception:

java -classpath dacapo-benchmark-suite-9.12.jar:dacapo-benchmark-callback-0.1.0-SNAPSHOT.jar Harness xalan --callback org.scalabench.dacapo.callback.XmlSummaryCallback
Using scaled threading model. 1 processors detected, 1 threads used to drive the workload, in a possible range of [1,100]
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:262)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:260)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:260)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1100)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:143)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:376)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
at org.scalabench.dacapo.callback.MarshallingSupport.loadSummary(MarshallingSupport.java:45)
at org.scalabench.dacapo.callback.MarshallingSupport.loadSummary(MarshallingSupport.java:54)
at org.scalabench.dacapo.callback.XmlSummaryCallback.loadSummary(XmlSummaryCallback.java:71)
at org.scalabench.dacapo.callback.XmlSummaryCallback.loadOrCreateSummary(XmlSummaryCallback.java:64)
at org.scalabench.dacapo.callback.XmlSummaryCallback.init(XmlSummaryCallback.java:56)
at org.dacapo.harness.TestHarness.runBenchmark(TestHarness.java:215)
at org.dacapo.harness.TestHarness.main(TestHarness.java:171)
at Harness.main(Harness.java:17)
Caused by: java.lang.ClassCastException: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl cannot be cast to javax.xml.datatype.DatatypeFactory
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:131)
at com.sun.xml.internal.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:773)
... 23 more

The problem is that JAXB, which is used to serialize the XML summary, loads some classes with the current context class loader. But during the callback operations this context is the benchmark's, which brings with it (in the case of xalan) its own, conflicting implementation of xercesImpl.jar.

IMHO, the solution is to temporarily revert the context class loader when performing callback operations.

Discussion


Log in to post a comment.