users@glassfish.java.net

XMLOutputFactory.newInstance method wrong signature in javaee.jar

From: <glassfish_at_javadesktop.org>
Date: Fri, 25 May 2007 04:09:11 PDT

Hi,

We're running into a conflict with the method signature of the javax.xml.stream.XMLOutputFactory.newInstance() method as it is part of the javaee.jar file in appserver version
9.0_01 (build b14). The stacktrace we get is:

java.lang.NoSuchMethodError: javax.xml.stream.XMLOutputFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLOutputFactory;
.at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:97)
.at org.apache.axiom.om.util.StAXUtils.createXMLStreamWriter(StAXUtils.java:123)
.at org.apache.axiom.om.impl.MTOMXMLStreamWriter.<init>(MTOMXMLStreamWriter.java:74)
.at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:410)
.at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:280)
.at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:214)

This code is part of the Apache Muse project and this project depends on the stax-api 1.0.1. In this API the definition for te method is as follows:

public static [b]XMLOutputFactory[/b] newInstance(String factoryId, ClassLoader classLoader)
throws FactoryConfigurationError

In our project we also depend on the javaee jar included in the appserver and this jar also include the javax.xml.stream.XMLOutputFactory class. After some investigation we discovered that the XMLOuptFactory class is loaded from the javaee.jar and the signature of the newInstance method in this version of XMLOutputFactory is:

public static [b]XMLInputFactory[/b] newInstance(String factoryId, ClassLoader classLoader)
throws FactoryConfigurationError

As you can see the version in the javaee.jar file returns an XMLInputFactory instead of an XMLOutputFactory. IMO this is completely wrong.

Anybody else ran into this issue? Are there workarounds or patches for the appserver that fix this? I tried to tweak the classpath a bit but that did not resolve the issue.

Any help is appreciated.

Gero
[Message sent by forum member 'gerovermaas' (gerovermaas)]

http://forums.java.net/jive/thread.jspa?messageID=218890