Question

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?

Était-ce utile?

La solution

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");  
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top