Friday, September 19, 2008

DBUnit and slf4j

I had never heard of slf4j before this morning, and I have no idea why.  I'm usually pretty up on stuff.

I started to pull some test data with dbunit ( in case you aren't familiar with dbunit here's an excellent intro by Bill Siggelkow ), and when I ran it I got the following error :

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at org.dbunit.database.AbstractDatabaseConnection.<clinit>(AbstractDatabaseConnection.java:46)
    at [my package and class].main(DBUnitExporter.java:62)

The solution is to download slf4j, and add slf4j-api-1.5.2.jar and slf4j-log4j12-1.5.2.jar to the classpath (I'm using Eclipse so I threw it in the run dialog.)
Blogged with the Flock Browser

3 comments:

Bill on Rails said...

Thanks for the props! SLF4J (giving it a full 2 seconds of research :) looks to be somewhat similar to Commons Logging.

Em Busca do JavaBean Perfeito said...

Hi there

I am seriously considering to move from Log4j to slf4j api and logback for this reasons

http://www.qos.ch/logging/classloader.jsp

I think you should look at this.

Hibernate and others are migrating too.

Regrads

Em Busca do JavaBean Perfeito said...

Here is the link for logBack

http://logback.qos.ch/faq.html#why_lgpl