Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.3
-
Fix Version/s: 1.3.1
-
Component/s: Converters
-
Labels:None
-
JDK version and platform:JDK 1.4.2_07 for Windows
Description
I'm using JDK1.4 and the DomDriver the convert my objects to XML and visa versa.
If I don't have any dependencies on other external libraries, everything works fine.
However, when I add xml-apis-1.3.04 to my classpath, XStream stops working properly.
The reason is that the xml-apis-1.3.04 contains the class "javax.xml.datatype.Duration" (but no implementation of javax.xml.datatype.DatatypeFactory) which causes XStream to think it can use the DurationConverter.
This results in the following exception:
com.thoughtworks.xstream.XStream$InitializationException: Could not instantiate converter : com.thoughtworks.xstream.converters.extended.DurationConverter : null at com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:748) at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:680) at com.thoughtworks.xstream.XStream.<init>(XStream.java:436) at com.thoughtworks.xstream.XStream.<init>(XStream.java:376) at com.thoughtworks.xstream.XStream.<init>(XStream.java:333) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:741) ... 29 more Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found at javax.xml.datatype.DatatypeFactory.newInstance(Unknown Source) at com.thoughtworks.xstream.converters.extended.DurationConverter.<init>(DurationConverter.java:33) ... 34 more Caused by: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl at java.net.URLClassLoader$1.run(URLClassLoader.java:199) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at javax.xml.datatype.FactoryFinder.newInstance(Unknown Source) at javax.xml.datatype.FactoryFinder.find(Unknown Source) ... 36 more
This is already fixed in the head revision, you may download the latest SNAPSHOT and give it a try. XStream will now only register converters for types that are delivered directly with the JDK it's running on. Converters for other types will have to be registered manually.