Problems running airline web application in Sun Application Server 8.2
I recently published my airline.war web application and verified that the wsdl and schema were published in a separate web application. However, when it came time to run the Airline servlet which would report the wsdl and schema metdata, I ran into the following problem. I had no issues with running the ant buildscript. I noticed that the saaj.jar file contained a two argument
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'messageHandlerAdapter' defined in ServletContext resource [/WEB-INF/airline-servlet.xml]: Cannot create inner bean 'org.springframework.ws.soap.saaj.SaajSoapMessageC ontextFactory#11f05a1' while setting bean property 'messageContextFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.ws.soap.saaj.SaajSoapMessageC ontextFactory#11f05a1' defined in ServletContext resource [/WEB-INF/airline-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.ws.soap.saaj.SaajSoapMessageCo ntextFactory]; constructor threw exception; nested exception is java.lang.NoSuchMethodError: javax.xml.soap.FactoryFinder.find(Ljava/lang/String;)Ljava/lang/Object;
The saaj.jar packaged with the sample project contains an implementation of this javax.xml.soap.FactoryFinder.find(x,x) with two arguments INSTEAD of ONE as the error message. I plugged into web-inf/classes the FactoryFinder from saajapi.jar from the jwsdp2.0 and it did not load this(after removing the class from saaj.jar). Substituting classes is probably not the right approach, perhaps there is an additional step or configuration that I might have missed somewhere.
Spring reflection loads wrong classes.
My Sun Appserver has jwsdp2.0 libraries pre-installed in C:\sun\appserver\lib.
Here is my situation jwsdp2.0 saaj-api.jar
spring-ws: saaj.jar
The abstract class javax.xml.soap.MessageFactory being loaded by org.springframework.ws.soap.saaj.SaajSoapMessageCo ntextFactory is one in the app server lib instead of the WEB-INF\lib\saaj.jar....
This is probably an appserver class loading switch somewhere perhaps in the server.policy
Spring WS reflection configuration
airline-servlet.xml snippet.
<bean id="messageHandlerAdapter" class="org.springframework.ws.transport.http.Messa geHandlerAdapter">
<property name="messageContextFactory">
<bean class="org.springframework.ws.soap.saaj.SaajSoapMe ssageContextFactory"/>
</property>
</bean>
"WEB-INF/lib" refers to the spring airline web-application class context.
"appserver/lib" refers to the sun appserver8.2 class context.
This is a classloading VM Spring issue:
SaajSoapMessageContextFactory(WEB-INF/lib)->MessageFactory(appserver/lib)-> FactoryFinder(WEB-INF/lib)
What is going on here is that Spring reflection loads MessageFactory from appserver/lib/javaee.jar(looking for single argument in the Spring web application context)
Then it tries to find FactoryFinder in the WEB-INF/lib/saaj.jar where only the two argument findFactory exists.
I tried to remove the jwsdp2.0 dependencies in my sunapp server, but either way, the conceptual issue at hand is Spring loading classes from the wrong class context and how to adjust it since WEB-INF/lib has a javax.xml.soap.MessageFactory which should be loaded instead of the appserver class context.