You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When changing xstream 1.4.14 to 1.4.16 a new parser (mxparser) was introduced. But xstream inside OSGI-Container (Virgo) does not seem to find the new parser, although packaged and residing in classpath.
This is the shortened stacktrace with the new version:
java.lang.IllegalStateException: com.thoughtworks.xstream.io.StreamException: Cannot create XmlPullParser
...
Caused by: com.thoughtworks.xstream.io.StreamException: Cannot create XmlPullParser
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:56)
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1303)
...
Caused by: org.xmlpull.v1.XmlPullParserException: caused by: org.xmlpull.v1.XmlPullParserException: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available
at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:294)
at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:259)
at com.thoughtworks.xstream.io.xml.XppDriver.createDefaultParser(XppDriver.java:62)
at com.thoughtworks.xstream.io.xml.XppDriver.createParser(XppDriver.java:68)
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1303)
(the apache-servicemix-bundles are the osgi-fied version of the regular ones, just adding import/export stuff to the manifest)
We also checked the import/export sections of the bundles for possible problems but we couldn't find anything. We also tried different versions of the xmlpull dependency, also without any luck.
Do you have any idea/advice why this does not work?
The text was updated successfully, but these errors were encountered:
I am no OSGi expert, all I know is, that I've missed to declare the MXParser as optional OSGI dependency. The xpp3_min also contains parts of xmlpull, therefore it might not affect the OSGI classloader.
Since XmlPull uses some kind of SPI (Service Provider Interface) to locate available XmlPull parsers, you might be affected by the problems described in this article. But be aware, that XmlPull is old and it's SPI implementation predates the Java ServiceLoader and does not follow the specification in all points. However, all of this would have to be done in the MXParser project.
XStream actually contains an own (user contributed) test module for OSGi, but I had to disable it because it breaks the release and does not run in Java 16, see #159. Any help is welcome.
What you can do instead for now: Use the MXParserDriver directly as ctor argument for XStream.
When changing xstream 1.4.14 to 1.4.16 a new parser (mxparser) was introduced. But xstream inside OSGI-Container (Virgo) does not seem to find the new parser, although packaged and residing in classpath.
This is the shortened stacktrace with the new version:
We switched from these dependencies (1.4.14)
to these (1.4.16)
(the apache-servicemix-bundles are the osgi-fied version of the regular ones, just adding import/export stuff to the manifest)
We also checked the import/export sections of the bundles for possible problems but we couldn't find anything. We also tried different versions of the xmlpull dependency, also without any luck.
Do you have any idea/advice why this does not work?
The text was updated successfully, but these errors were encountered: