Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-26214

Can't use StAX from inside a plugins 2 plugin without embedded woodstox in the plugin.

XMLWordPrintable

      Issue Summary

      Can't use StAX from inside a plugins 2 plugin without embedded woodstox in the plugin.

      Steps to Reproduce

      From a v2 plugin call this:

      XMLInputFactory factory = XMLInputFactory.newFactory();
      factory.createXMLEventReader(new StringReader("<a></a>"));
      

      Expected Results

      The call is successful

      Actual Results

      You end up with:

      javax.xml.stream.FactoryFinder$ConfigurationError: Provider com.ctc.wstx.stax.WstxInputFactory not found
      	at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:154)
      	at javax.xml.stream.FactoryFinder.findJarServiceProvider(FactoryFinder.java:308)
      	at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:233)
      	at javax.xml.stream.XMLInputFactory.newFactory(XMLInputFactory.java:156)
      	at com.atlassian.jira.dev.functest.ao.BlogResource.getAll(BlogResource.java:91)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:206)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:90)
      

      Notes

      • JIRA ships with wstx-asl-3.2.4.jar (Woodstox) in WEB-INF/lib. This JAR registers itself with the JVM to provide implementations of XMLInputFactory, XMLOutputFactory and XMLEventFactory from its META-INF.services. Basically, once we put this JAR in WEB-INF/lib we end up with com.ctc.wstx.stax.WstxInputFactory, com.ctc.wstx.stax.WstxOutputFactory and com.ctc.wstx.stax.WstxEventFactory being the default implementations of these classes.
      • The problem is that we don't expose the wstx-asl-3.2.4.jar classes to plugins even though we expose its META-INF.services (we boot delegate META-INF.services)).
      • The solution is NOT to simply add the wstx-asl to the packages that we expose to plugins (what happens we change the JAR and replace with a different implementation?).

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Unassigned Unassigned
              bbain bain
              Votes:
              27 Vote for this issue
              Watchers:
              34 Start watching this issue

                Created:
                Updated: