SAX Parser error on load
Getting this error whenever I try to load a theme via XML
[ 9847] ERROR - pplication.impl.LaterInvocator - org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
at org.fife.ui.rsyntaxtextarea.Theme$XmlHandler.load(Theme.java:603)
For the load I am using the example from the wiki:
try {
Theme theme = Theme.load(getClass().getResourceAsStream(
"/org/fife/ui/rsyntaxtextarea/themes/eclipse_theme.xml"));
theme.apply(responseBodyEditorPane);
} catch (IOException ioe) { // Never happens
ioe.printStackTrace();
}
Sounds like a dependency issue. Is this an OSGi app, or some other classloadery framework-based app? Whether it is or isn't, the issue is likely more than one Xerces on your classpath and one causing trouble.
Hopefully some starting points:
- http://stackoverflow.com/questions/6596218/parser-error-on-xpand-saxparserfactoryimpl-cannot-be-cast-to-saxparserfactory
- https://answers.atlassian.com/questions/104121/im-blocked-help-cannot-be-cast-to-javax.xml.parsers.saxparserfactory
Ahhh, I am using this within an intellij plugin because there's zero documentation on how to or whether or not it is possible to use internal intellij syntax highlighting. So maybe there's a collision in there?
Interesting, I didn't know there was a plugin - which one exactly? I see some IntelliJ plugins that use RSTA - soapUI, JSON formatting, etc.
My guess is yes - IntelliJ has xerces on its classpath. Unfortunately I won't be much help diagnosing it. :( It might be that getClass().getClassLoader() is the wrong classloader (if IntelliJ threads its plugin loading or gives each plugin its own classpath in some other way).