• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

First test attempt fails: log class '...Log4JLogger' cannot be found or is not useable. Why?

 
Edward Winchester
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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?

Thanks,

Ed
 
Edward Winchester
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Ed
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Log4J also needs to be on your classpath; I doubt it's a bug. It's more likely that the test execution classpath wasn't what you thought it was.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic