JAX-WS没有注入WebServiceContext

时间:2013-07-31 20:32:45

标签: web-services jboss jax-ws jboss5.x

我使用JAX-WSJBOSS 5.1.0创建了一项网络服务。在我的服务类的顶部,我把:

@Resource
private WebServiceContext context;

但是当我尝试在我的任何网络服务方法中访问context时,我得到NullPointerException,因为上下文是null。有没有人知道为什么JAX-WS没有正确设置它以及如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我也得到了空。如果您使用的是Spring,请添加:

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

它对我有用。