Using StAX in Java 5 plugin

I'm trying to use a StAX parser in a plugin compiled (and running) under Java 5.  I get the exception shown below when trying to access the input factory which indicates no StAX imlementations in the class path. This despite the fact that I added the woodstox Stax parser (and also tried sjsxp as well) to the plugin lib dir.

I tried explicitly setting system properties to use woodstox but then sufferedClassDefNotFound exception on com.ctc.wstx.stax.WstxInputFactory.  The proper jars are in my plugin lib dir AFAIK, so they should be in the plugin's classpath right?

        System.setProperty("", "com.ctc.wstx.stax.WstxInputFactory");
        System.setProperty("", "com.ctc.wstx.stax.WstxOutputFactory");
        System.setProperty("", "com.ctc.wstx.stax.WstxEventFactory");

Any tips for using StaX in a plugin like this?

John Lindwall

Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(1553,352),button=1,modifiers=Button1,clickCount=1] on frame1: Provider not found Provider not found
 at com.shopzilla.ideaplugin.templateVariables.ui.TemplateVariablesUI$GetValueActionListener.getTemplateVariableValue(
 at com.shopzilla.ideaplugin.templateVariables.ui.TemplateVariablesUI$GetValueActionListener.actionPerformed(
 at javax.swing.AbstractButton.fireActionPerformed(
 at javax.swing.AbstractButton$Handler.actionPerformed(
 at javax.swing.DefaultButtonModel.fireActionPerformed(
 at javax.swing.DefaultButtonModel.setPressed(
 at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
 at java.awt.AWTEventMulticaster.mouseReleased(
 at java.awt.Component.processMouseEvent(
 at javax.swing.JComponent.processMouseEvent(
 at java.awt.Component.processEvent(
 at java.awt.Container.processEvent(
 at java.awt.Component.dispatchEventImpl(
 at java.awt.Container.dispatchEventImpl(
 at java.awt.Component.dispatchEvent(
 at java.awt.LightweightDispatcher.retargetMouseEvent(
 at java.awt.LightweightDispatcher.processMouseEvent(
 at java.awt.LightweightDispatcher.dispatchEvent(
 at java.awt.Container.dispatchEventImpl(
 at java.awt.Window.dispatchEventImpl(
 at java.awt.Component.dispatchEvent(
 at java.awt.EventQueue.dispatchEvent(
 at com.intellij.ide.IdeEventQueue.f(
 at com.intellij.ide.IdeEventQueue.b(
 at com.intellij.ide.IdeEventQueue.dispatchEvent(
 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(
 at java.awt.EventDispatchThread.pumpEvents(
 at java.awt.EventDispatchThread.pumpEvents(

1 comment

I'm suspecting the problem is a classloader issue.  My theory is that the is being loaded from the parent (ie IntelliJ) classloader. This classloader does not have the woodstox classes in its classpath, hence the FactoryConfigurationError.

If there is a StAX parser in the parent classpath I could use system properties to select that implementation and I think everything would be fine.  I'm not sure if this is the case.

Luckily the invocation of XMLInputFactory.newInstance() is in code that I have the source for.   My workaround was to modify this code to explicitly instantiate the woodstox implementation directly instead of using the XMLInputFactory.  This is ham-handed but does the trick for now.


Please sign in to leave a comment.