This commit is contained in:
Arjen Poutsma
2007-10-22 21:30:05 +00:00
parent a7fb4bbaab
commit beef3660b5

View File

@@ -11,16 +11,49 @@
bundled with the older XML parser Crimson, which does not handle namespaces correctly. Additionally,
it is bundled with an older version of Xalan, which also has problems.
Unfortunately, placing newer versions of these on the class path does not override them.
See <a href="http://xml.apache.org/xalan-j/faq.html#faq-N100D6">this FAQ</a> entry on the Xalan
site, and also <a href="http://xerces.apache.org/xerces2-j/faq-general.html#faq-4">this entry</a>
See
<a href="http://xml.apache.org/xalan-j/faq.html#faq-N100D6">this FAQ</a>
entry on the Xalan
site, and also
<a href="http://xerces.apache.org/xerces2-j/faq-general.html#faq-4">this entry</a>
on the Xerces site.
</p>
<p>
The only solution that works is to add newer versions of Xerces and Xalan in the lib/endorsed
directory of your JDK, as explained in those FAQs.
directory of your JDK, as explained in those FAQs (i.e.<tt>$JAVA_HOME/lib/endorsed</tt>).
The following libraries are known to work with Java 1.4.2:
</p>
<table class="bodyTable">
<tbody>
<tr>
<th>Library</th>
<th>Version</th>
</tr>
<tr>
<td>
<a href="http://xerces.apache.org/xerces2-j/">Xerces</a>
</td>
<td>2.8.1</td>
</tr>
<tr>
<td>
<a href="http://xml.apache.org/xalan-j/">Xalan</a>
</td>
<td>2.7.0</td>
</tr>
<tr>
<td>
<a href="http://xerces.apache.org/xerces2-j/">XML-APIs</a>
</td>
<td>1.3.04</td>
</tr>
</tbody>
</table>
<p>
Note that the security module requires Java 5, because an underlying library (XWSS) requires it.
Note that the security module requires Java 5, because an underlying library (XWSS) requires it.
Also note that SAAJ 1.3 required Java 5 as well, so you need to use SAAJ 1.2 (which can be
downloaded as part of the<a href="http://java.sun.com/webservices/downloads/1.3/index.html">
Java Web Services Developer Pack 1.3</a>.
</p>
</answer>
</faq>
@@ -30,7 +63,7 @@
<p>
Spring Web Services works under Java 1.6, but you must make sure to use the versions of Xerces and
Xalan that are packaged with it. Using other XML parsing libraries will cause exceptions to occur
in the <tt>org.apache.xml.serializer.ToXMLSAXHandler</tt>.
in the<tt>org.apache.xml.serializer.ToXMLSAXHandler</tt>.
</p>
<p>
Therefore, when using Java 6, do not bundle Xerces, nor Xalan in your application.
@@ -47,7 +80,10 @@
</p>
<p>
The jar can be found at
<tt>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/.compatibility/14compatibility.jar</tt>.
<tt>
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/.compatibility/14compatibility.jar
</tt>
.
You can safely remove or rename it, and the tests will run again.
</p>
</answer>
@@ -59,14 +95,17 @@
<question>What is SAAJ?</question>
<answer>
<p>
SAAJ is the SOAP with Attachments API for Java. Previously, it has been part of JAXM, but it has
SAAJ is the SOAP with Attachments API for Java. Like most Java EE libraries, it consists of a set of
interfaces (<tt>saaj-api.jar</tt>), and implementations (<tt>saaj-impl.jar</tt>). When running in
a Application Server, the implementation is typically provided by the application server.
Previously, SAAJ has been part of JAXM, but it has
been released as a seperate API as part of the
<a href="http://java.sun.com/webservices/jwsdp/index.jsp">Java Web Service Developer Pack</a>, and
also as part of J2EE 1.4. SAAJ is generally known as the package <tt>javax.xml.soap</tt>.
also as part of J2EE 1.4. SAAJ is generally known as the package<tt>javax.xml.soap</tt>.
</p>
<p>
Spring-WS uses this standard SAAJ library to create representations of SOAP messages. Alternatively,
it can use <a href="http://ws.apache.org/commons/axiom/index.html">Apache AXIOM</a>.
it can use<a href="http://ws.apache.org/commons/axiom/index.html">Apache AXIOM</a>.
</p>
</answer>
</faq>
@@ -85,7 +124,9 @@
</tr>
<tr>
<td>BEA WebLogic 9</td>
<td>1.1/1.2 <sup>*</sup></td>
<td>1.1/1.2
<sup>*</sup>
</td>
</tr>
<tr>
<td>IBM WebSphere 6</td>
@@ -97,30 +138,36 @@
</tr>
<tr>
<td>JBoss 4.2</td>
<td>1.3 <sup>**</sup></td>
<td>1.3
<sup>**</sup>
</td>
</tr>
</tbody>
</table>
<p>* = See <a href="#saaj-weblogic9">below</a>.</p>
<p>** = See <a href="#saaj-jboss">below</a>.</p>
<p>* = See<a href="#saaj-weblogic9">below</a>.
</p>
<p>** = See<a href="#saaj-jboss">below</a>.
</p>
<p>Additionally, Java SE 6 includes SAAJ 1.3.</p>
</answer>
</faq>
<faq id="saaj-nosuchmethod">
<question>I get an <tt>NoSuchMethodError</tt> when using SAAJ. What can I do about it?
<question>I get an
<tt>NoSuchMethodError</tt>
when using SAAJ. What can I do about it?
</question>
<answer>
<p>If you get the following stack trace:</p>
<pre>
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.ws.soap.saaj.SaajSoapMessageFactory'
defined in ServletContext resource [/WEB-INF/springws-servlet.xml]:
Invocation of init method failed;
nested exception is java.lang.NoSuchMethodError:
javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/MessageFactory;
Caused by:
java.lang.NoSuchMethodError:
javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/MessageFactory;
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.ws.soap.saaj.SaajSoapMessageFactory'
defined in ServletContext resource [/WEB-INF/springws-servlet.xml]:
Invocation of init method failed;
nested exception is java.lang.NoSuchMethodError:
javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/MessageFactory;
Caused by:
java.lang.NoSuchMethodError:
javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/MessageFactory;
</pre>
<p>
Like most J2EE libraries, SAAJ consists of two parts: the API that consists of interfaces
@@ -138,16 +185,20 @@ javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/Mes
</faq>
<faq id="saaj-weblogic9">
<question>
I get a <tt>UnsupportedOperationException</tt> "This class does not support SAAJ 1.1" when I use SAAJ
I get a
<tt>UnsupportedOperationException</tt>
"This class does not support SAAJ 1.1" when I use SAAJ
under WebLogic 9. What can I do about it?
</question>
<answer>
<p>
Weblogic 9 has a known bug in the SAAJ 1.2 implementation: it implement all the 1.2 interfaces,
but throws <tt>UnsupportedOperationExceptions</tt> when you call them.
Confusingly, the exception message is <tt>This class does not support SAAJ 1.1</tt>, even though
it supports SAAJ 1.1 just fine; it just doesn't support SAAJ <strong>1.2</strong>.
See also <a href="http://forums.bea.com/bea/thread.jspa?threadID=600007964">this BEA forum post</a>.
but throws
<tt>UnsupportedOperationExceptions</tt>
when you call them.
Confusingly, the exception message is<tt>This class does not support SAAJ 1.1</tt>, even though
it supports SAAJ 1.1 just fine; it just doesn't support SAAJ<strong>1.2</strong>.
See also<a href="http://forums.bea.com/bea/thread.jspa?threadID=600007964">this BEA forum post</a>.
</p>
<p>
Spring-WS has a workaround for this, we basically use SAAJ 1.1 only when dealing with Weblogic 9.
@@ -157,28 +208,34 @@ javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/Mes
<p>
The solution is to not use BEA's version of SAAJ, but to use another implementation, like the one
from Axis 1, or SUN. In you application context, use the following:
<source><bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="com.sun.xml.messaging.saaj.soap.MessageFactoryImpl"/>
</property>
</bean></source>
<source>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="com.sun.xml.messaging.saaj.soap.MessageFactoryImpl"/>
</property>
</bean>
</source>
</p>
</answer>
</faq>
<faq id="saaj-jboss">
<question>
I get a <tt>IndexOutOfBoundsException</tt> when I use SAAJ under JBoss. What can I do about it?
I get a
<tt>IndexOutOfBoundsException</tt>
when I use SAAJ under JBoss. What can I do about it?
</question>
<answer>
<p>
The SAAJ implementation provided by JBoss has some issues. The solution is therefore not to use
the JBoss implementation, but to use another implementation. For instance, you can use SUN's
reference implementation like so:
<source><bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
</property>
</bean></source>
<source>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
</property>
</bean>
</source>
</p>
</answer>
</faq>
@@ -213,13 +270,19 @@ javax.xml.soap.MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/Mes
disadvantage that the "location" attribute in the WSDL is static, i.e. it does not
necessarily reflect the host name of the server. You can transform locations by using a
<a href="http://static.springframework.org/spring-ws/site/apidocs/org/springframework/ws/transport/http/WsdlDefinitionHandlerAdapter.html">
<tt>WsdlDefinitionHandlerAdapter</tt>
</a>.
<tt>WsdlDefinitionHandlerAdapter</tt>
</a>
.
</li>
<li>Use the <tt>MessageDispatcherServlet</tt>, which is done is the samples. Every
<tt>WsdlDefinition</tt> listed in the <tt>*-servlet.xml</tt> will be exposed under the
bean name. So if you define a <tt>WsdlDefinition</tt> named <tt>echo</tt>, it will be
exposed as <tt>echo.wsdl</tt>. (i.e. <tt>http://localhost:8080/echo/echo.wsdl</tt>).
<li>Use the<tt>MessageDispatcherServlet</tt>, which is done is the samples. Every
<tt>WsdlDefinition</tt>
listed in the
<tt>*-servlet.xml</tt>
will be exposed under the
bean name. So if you define a
<tt>WsdlDefinition</tt>
named<tt>echo</tt>, it will be
exposed as<tt>echo.wsdl</tt>. (i.e.<tt>http://localhost:8080/echo/echo.wsdl</tt>).
</li>
</ul>
</p>