1

I am trying to run JUnit on a Maven/Spring project and am testing with a web service client (axis2).

Here is the buggy web service client calls:

ProServiceLocator locator = new ProServiceLocator(); // CRASH
proServiceEndpoint = locator.getProServicePort();

Here is the error:

java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.discovery.DiscoveryException: No implementation defined for org.apache.commons.logging.LogFactory

Here is my sub-project's POM:

...
<dependency>
        <artifactId>commons-logging</artifactId>
        <groupId>commons-logging</groupId>
        <version>${commons-logging.version}</version>
    </dependency>

Help?

Exegesis
  • 1,028
  • 1
  • 18
  • 47
  • 2
    There is another member who had the same error here : http://stackoverflow.com/questions/9460864/common-logging-jar-conflict-with-apache-axis-soap-client – Mannekenpix Jan 28 '14 at 10:27

1 Answers1

3

Placing the below code in my empty "*Test.java" file made it work!

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