我在使用 spring jax-ws SimpleJaxWsServiceExporter 公开独立 Web 服务进行远程处理时遇到问题。以下是我在启动应用程序时的配置和错误消息。我使用 JBoss 5.1.0 作为应用服务器。请帮我配置一下。我没有使用任何 com.sun.xml.ws.transport.http.servlet.WSSpringServlet,因为我想将 Web 服务公开为独立的。
我的 applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<context:annotation-config />
<aop:aspectj-autoproxy proxy-target-class="true" />
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8989/services" />
</bean>
<bean id="carServiceEndpoint" class="com.webservices.CarServiceEndpoint" />
我的端点类:
@Service("CarService")
@WebService(endpointInterface = "com.webservices.ICarServiceEndpoint", serviceName = "CarService")
public class CarServiceEndpoint implements ICarServiceEndpoint {
@Autowired
CarService carService;
@Override
public Car getCar() {
return carService.getCar();
}
@Override
public Car process(Car car) {
return carService.getCar();
}
}
我的端点实现的接口:
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(serviceName = "CarService")
public interface ICarServiceEndpoint {
@WebMethod
public Car getCar();
@WebMethod
public Car process(@WebParam(name = "car") Car car);
}
我的域对象:
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Car")
public class Car implements Serializable {
private static final long serialVersionUID = 1L;
private String carId;
private String carName;
public String getCarId() {
return carId;
}
public void setCarId(String carId) {
this.carId = carId;
}
public String getCarName() {
return carName;
}
public void setCarName(String carName) {
this.carName = carName;
}
}
错误信息:
org.springframework.beans.factory.BeanCreationException:在 ZipEntryHandler@1724575[path=provider.war/WEB-INF/lib/core-services- 1.0.0-SNAPSHOT.jar/module-beans/applicationContext.xml context=file:/D:/Softwares/JBoss5.1.x/jboss510/server/NEWFW_SERVER/deploy/real=file:/D:/Softwares/JBoss5 .1.x/jboss510/server/NEWFW_SERVER/deploy/provider.war/WEB-INF/lib/core-services-1.0.0-SNAPSHOT.jar/module-beans/applicationContext.xml]:调用init方法失败;嵌套异常是 java.lang.IllegalArgumentException: class com.webservices.CarServiceEndpoint$$EnhancerByCGLIB$$3002d7c 既没有 @WebService 也没有 @WebServiceProvider 注释