org.apache.axis2.AxisFault: Service class XXXXX must have public as access Modifier解决方案

使用Axis2工具生成客户端调用辅助类后,编写客户端调用代码运行时报错,完整错误信息如下:

log4j:WARN No appenders could be found for logger (org.apache.axiom.locator.DefaultOMMetaFactoryLocator).
log4j:WARN Please initialize the log4j system properly.
org.apache.axis2.AxisFault: Service class com.csdn.ws.axis2.recipe01.HelloWorld must have public as access Modifier
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:368)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
    at com.csdn.ws.axis2.recipe01.HelloWorldStub.sayHello(HelloWorldStub.java:162)
    at com.csdn.ws.axis2.recipe01.client.Client.main(Client.java:15)

乍一看错误信息好像是说web服务接口和实现类必须定义为public,检查代码发现就是public,真正的原因是在services.xml中描述WebService时

<parameter name="ServiceClass">
        com.csdn.ws.axis2.recipe01.HelloWorldImpl
</parameter>

ServiceClass属性应该指定Web服务实现类,而不是接口。

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