Spring context file cannot be located for AxisServ

今天采用axis2最新版1.7.1和spring进行整合启动报错Caused by: org.apache.axis2.AxisFault: Spring context file cannot be located for AxisService

at org.apache.axis2.extensions.spring.util.ApplicationContextUtil.getSpringApplicationContext(ApplicationContextUtil.java:120)
at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:46)
at org.apache.axis2.util.Utils.createServiceObject(Utils.java:702)
at org.apache.axis2.util.Utils.getServiceClass(Utils.java:784)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:431)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
... 27 more
查了半天百度最终也没有得到正确解决办法,后来查了google终于解决。

在stackoverflow网站中有人遇到了同样的问题,大神给了回复,按照大神的回复成功解决。下面我贴出解决方法:

在你的services.xml中配置spring上下文环境的时候,在最新版本换了个类。

老版本的写法:

 <parameter name="ServiceObjectSupplier" locked="false">
            org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
        </parameter>

注意:上面的写法是老版本的写法,最新版本的写法要换成下面的写法:

正确的写法:

<parameter name="ServiceObjectSupplier" locked="false">
            org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
        </parameter>


然后重新启动项目发现就可以正常访问了。


你可能感兴趣的:(spring,axis2)