I have some code like:

import javax.xml.stream.XMLEventReader;

...

XMLInputFactory xmlin = XMLInputFactory.newInstance()

which has been written in Eclipse.

This code produces an error like:

Caught: java.lang.ClassCastException: com.bea.xml.stream.MXParserFactory cannot be cast to javax.xml.stream.XMLInputFactory

Which I can't work out at the moment. I suspect it's something to do with a library clash (similar to Woodstox stax and java stax conflict) but I'm not sure if that's correct, or how to resolve it.

If anyone can point me in a direction to start understanding this behaviour that would be great!

Thanks, Arlo

有帮助吗?

解决方案

The problem here is to do with the build path. I had an old version of Stax-api being picked up somewhere.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top