简体   繁体   中英

No implementation defined for org.apache.commons.logging.LogFactory while accessing the axis webservice

Getting the below error while accessing the webservice..Tried applying the common-logging.jar but issue din resolved.

org.apache.commons.discovery.DiscoveryException: No implementation defined for org.apache.commons.logging.LogFactory while accessing the axis webservice

able to access the same service with main method from a test project which includes jaxrpc,mail.jar,wsdl4.jar,commons-discovery-0.2.jar,commons-logging-api-...as shown below 1 测试项目的Jar列表

but the same service is giving the issue which contains the below jar list..have added commons-discovery-0.4 as well in addition to 0.2

在此输入图像描述

You don't have dependency-hierarchy tab in your IDE. So for checking the dependency tree Install maven as mentioned below:

Download maven bin zipped file

Unzip and paste in Program Files folder

Edit Path Environment Variable (add maven bin folder location in the path)

Go to project home directory

Run following command: mvn dependency:tree -Doutput=output.txt

This will generate maven dependency tree.

Now check which all dependency in your pom.xml is showing multiple times (use Ctrl + F) feature or do it manually. Now remove the dependency which is showing more them two times using <exclusions> tag (already explained you for axis2-kernel, same like that).

Now add separately commons-loging maven dependency:

<dependency> 
  <groupId>commons-logging</groupId> 
  <artifactId>commons-logging</artifactId> 
  <version>1.0.3</version> 
</dependency>

This process will remove duplicate dependency and remove your commons-logging framework problem.

If face issue just comment.

Issue is resolved by adding the below to commons-logger.properties and added the file to classpath

org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger org.apache.commons.logging.LogFactory = org.apache.commons.logging.impl.LogFactoryImpl

In case this would help somebody struggling with this exception on a JUnit unit test, the below did not work for me.

@BeforeClass
public static void beforeClass() {
System.setProperty("org.apache.commons.logging.LogFactory", 
"org.apache.commons.logging.impl.LogFactoryImpl");
System.setProperty("org.apache.commons.logging.Log", 
"org.apache.commons.logging.impl.Log4JLogger");
}

what worked was replacing the first statement with the below.

System.setProperty(LogFactory.FACTORY_PROPERTY, LogFactory.FACTORY_DEFAULT);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM