I'm using Netbeans 6.7.1 to develop my app. I've just written a DAO to store a file in a database and want to test it using JUnit 4.5. When I run the test I am getting an error: smallFile caused an ERROR (User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.)
Here's my unit test code:
The FileStoreDAOImpl uses commons-logging which is pointed at Log4J. Here's a snippet of class FileStoreDAOImpl:
I have verified that commons-logging is available on my classpath. I even replaced the code in test "smallFile" with some code to print out a classpath and can see the commons-logging.jar there.
Can someone help me get past this problem please?
Joined: Sep 16, 2009
I got it to work but it doesn't make sense to me why it works.
In the Project Properties, under Libraries category and the Compile Tests tab, I had Log4j.1.2.15 library specified. (The library references log4j-1.2.15.jar).
To make it work I also added the jar explicitly. Perhaps this is a Netbeans 6.7.1 bug?
Anyway, I think I can carry on for now but I would like to understand exactly what's going on as it make me feel a bit uncomfortable.