I am trying to use JAXB 2 and spring-ws 2.0.3 to make a SOAP service on glassfish 3.
I am having some problems with the xml file configurations because there is a ton of information (tutorials, examples) about getting older versions of these packages running but not much on the newer versions.
I have succesfully gotten client/server programs working through the httpInvokerProxy remoting service, but the amount of configuration required in these files is substantially more.
Essentially I used the xjc maven tool to create java classes out of my xml schema and the spring-ws annotations @PayloadRoot, @EndPoint, and @ResponsePayload to mark the methods in my endpoint java class. I am just trying to be sure that my wsdl file is available at the correct URL and that soap requests are being accepted and the responses delivered.
If someone could recommend a good place to get this information or have the heart to look through my 3 xml files I would be very greatful. Otherwise, here is the error I am getting when going to the root servlet directory after uploading the war file.
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.context.support.XmlWebApplicationContext]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter
My xml files are as follows:
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Licensing SOAP Service</display-name>
<servlet>
<servlet-name>licensingSOAPService</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>licensingSOAPService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
licensingSOAPService-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<import resource-"/applicationContext.xml"/>
<bean id = "licensingSOAPService" class="mypackage.soap.LicensingSOAPService">
</bean>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<description>An endpoint mapping strategy that looks for @Endpoint and @PayloadRoot annotations.</description>
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
<description>Enables the MessageDispatchServlet to invoke methods requiring OXM marshalling.</description>
<constructor-arg ref="marshaller"/>
</bean>
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
p:contextPath="mypackage.schemas" />
<bean id = "licensingWSDL" class ="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name = "schema" ref = "schema">
<property name = "portTypeName" value = "licenseResource"/>
<property name = "locationUri" value ="/licensing/schema/" />
<property name = "targetNamespace" value = "mypackage/schemas" />
</bean>
<bean id ="schema" class ="org.springframework.xml.xsd.SimpleXsdSchema">
<property name ="xsd" value = "/licenseSchema.xsd"/>
</bean>
</beans>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
<sws:annotation-driven />
<context:component-scan base-package="mypackagel.licensing"/>
</beans>
Does anybody see anything blatantly wrong with these?
EDIT:
Wanted to include dependency part of my pom.xml as it was pointed out (correctly so) that I have both spring 3.1 AND spring 3.5 jars in my war file.
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>LicensingSOAPService</finalName>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
The exception message refers to the method
This method was only introduced in Spring 3.1 (see javadoc), so something in your setup is assuming the presence of Spring 3.1, but you seem to be running 3.0.
You need to upgrade Spring to 3.1