XStream
  1. XStream
  2. XSTR-537

xstream fails with xml-apis in the classpath

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major 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
      

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Maarten Coene
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: