axis报No engine configuration file

在使用axis时出现如下错误:

Service service = new Service();一行抛出如下异常:

org.apache.axis.ConfigurationException: org.apache.axis.ConfigurationException: java.lang.Exception: No engine configuration file – aborting! at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:214) at org.apache.axis.AxisEngine.init(AxisEngine.java:189) at org.apache.axis.AxisEngine.<init>(AxisEngine.java:174)

解决方法:

这个问题是由于找不到axis的配置文件client-config.wsdd 导致的。

这个文件在axis.jar包里的org/apache/axis/client目录下。

解决方法一:

请检查应用的WEB-INF目录下是否存在axis.jar,axis.jar包的org/apache/axis/client目录下是否存在client-config.wsdd。

如果不存在,可能是引用的axis.jar包不对,可以更换axis.jar。

解决方法二:

在WEB-INF/classes目录下新建org/apache/axis/client目录,该目录下新建client-config.wsdd文件,文件内容如下:

<?xmlversion=”1.0″encoding=”UTF-8″?>

<deploymentname=”defaultClientConfig”

xmlns=”http://xml.apache.org/axis/wsdd/”

xmlns:java=”http://xml.apache.org/axis/wsdd/providers/java”>

<globalConfiguration>

<parametername=”disablePrettyXML”value=”true”/>

<parametername=”enableNamespacePrefixOptimization”value=”false”/>

</globalConfiguration>

<transportname=”http”pivot=”java:org.apache.axis.transport.http.HTTPSender”/>

<transportname=”local”pivot=”java:org.apache.axis.transport.local.LocalSender”/>

<transportname=”java”pivot=”java:org.apache.axis.transport.java.JavaSender”/>

</deployment>

解决方法三:

将client-config.wsdd文件放到任意路径下,比如D:/tomcat/webapps/axis/WEB-INF/client-config.wsdd。然后在调用服务的客户端代码中指定该配置文件,,代码如下:

System.setProperty(“axis.ClientConfigFile”, “D://tomcat//webapps//axis//WEB-INF//client-config.wsdd”); Service service = new Service();

或者:

EngineConfiguration config = new FileProvider(“D://tomcat//webapps//axis//WEB-INF//client-config.wsdd”);Service service = new Service(config);

如果发现错了,一定要止步.

axis报No engine configuration file

相关文章:

你感兴趣的文章:

标签云: