首页 > 代码库 > Axis和Log4j一起使用时,出现异常org.apache.axis.ConfigurationException

Axis和Log4j一起使用时,出现异常org.apache.axis.ConfigurationException

调用成功,但是出现异常出现异常:org.apache.axis.ConfigurationException: No service named  is available org.apache.axis.ConfigurationException: No service named  is available
 
解决方法:stackoverflow上 http://stackoverflow.com/questions/65310/apache-axis-configurationexception
 
Just a guess, but it looks like that error message is reporting that you‘ve left the service name blank. I imagine the code that generates that error message looks like this: 

throw
newConfigurationException("No service named"+ serviceName +" is available");
 
According to the documentation linked to by @arnonym, this exception is somewhat misleading. In the first attempt to find the service a ConfigurationException is thrown and caught. It is logged at DEBUG level by the ConfigurationException class. Then another attempt is made using a different method to find the service that may then succeed. The workaround for this is to just change the log level on the ConfigurationException class to INFO in your log4j.properties:
 
log4j.logger.org.apache.axis.ConfigurationException= INFO
 
我采用的第二种方法,加上之后没有再打印异常信息了。
 
另:参考http://wiki.apache.org/ws/FrontPage/Axis/DealingWithCommonExceptions