我正在使用Spring 3.1.3和spring ws-2.1.1 开发一个简单的 Web 服务。
我的 web.xml 是——
<servlet>
<servlet-name>spring-ws-service</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring-ws-service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
而来自 Meta-inf 的 spring-ws-servlet.xml 就像——
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="stringReversalService">
</bean>
<bean id="stringReversalServiceEndpoint">
<property name="stringReversalService" ref="stringReversalService"/>
</bean>
<bean id="payloadMapping">
<property name="defaultEndpoint" ref="stringReversalServiceEndpoint"/>
</bean>
<bean id="stringReversalSchema">
<property name="xsd" value="/WEB-INF/reversalService.xsd"/>
</bean>
<bean id="stringReversal">
<property name="schema" ref="stringReversalSchema"/>
<property name="portTypeName" value="stringReversal"/>
<property name="locationUri" value="http://localhost:8080/string-reversal/services"/>
</bean>
</beans>
在 JBoss 7.1.1 上构建战争和部署时,我得到:-
18:20:45,299 INFO [org.jboss.as.server] (HttpManagementService-threads - 4) JBAS018558: Undeployed "Spring-WS-WebService.war"
18:22:18,174 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "Spring-WS-WebService.war"
18:22:18,197 WARN [org.jboss.as.ee] (MSC service thread 1-8) JBAS011006: Not installing optional component ***org.springframework.ws.transport.http.MessageDispatcherServlet due to exception: java.lang.ClassNotFoundException: org.springframework.ws.transport.http.MessageDispatcherServlet from [Module "deployment.Spring-WS-WebService.war:main" from Service Module Loader]***
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_26]
at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_26]
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:79)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]