FasterXML/aalto-xml

java.lang.NoClassDefFoundError: javax/xml/stream/events/XMLEvent

sanafaraz1 opened this issue · 2 comments

Hi,

When consuming com.fasterxml.aalto.stax.InputFactoryImpl for my parsing with version 1.2.2, I found an issue, Caused by: java.lang.NoClassDefFoundError: javax/xml/stream/events/XMLEvent.
This is because while creating the XMLEventAllocator(since I have not set one explicitly), it tries to create one using EventAllocatorImpl class. Here aalto xml does not import package- javax.xml.stream.events, which is why the we face the NoClassDefFoundError.
Kindly rectify this as I workaround I will be using the stax2 event allocator.
StackTrace:
Caused by: java.lang.NoClassDefFoundError: javax/xml/stream/events/XMLEvent
at com.fasterxml.aalto.stax.InputFactoryImpl.createEventAllocator(InputFactoryImpl.java:594)
at com.fasterxml.aalto.stax.InputFactoryImpl.constructER(InputFactoryImpl.java:583)
at com.fasterxml.aalto.stax.InputFactoryImpl.createXMLEventReader(InputFactoryImpl.java:131)
at com.fasterxml.aalto.stax.InputFactoryImpl.createXMLEventReader(InputFactoryImpl.java:126)
at org.apache.olingo.client.core.serialization.AtomDeserializer.getReader(AtomDeserializer.java:106)

Please provide details like Java version. Looks like some essential classes are missing.

@sanafaraz1 If your JDK installation does not come with Stax API classes, you will need to add a dependency. Since JDK 6 and above include it, Aalto does no longer include a dependency (since externally available api may or may not match what JDK gives).

So: this is not something Aalto can do for you.