0

I am testing BoneCP along with other Connection pool solutions and I am having trouble getting BoneCP to work. (Using a simple Java application in Eclipse)

The code I am using is copied from the BoneCP JDBC Example.

Following the BoneCP Requirements I have configured the build path by importing the following external JARs:

  • SLF4J - slf4j-jdk14-1.7.5.jar
  • Google Guava - guava-14.0.1.jar

The following is the error I get when I attempt to run the Java Application:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at com.jolbox.bonecp.BoneCPConfig.(BoneCPConfig.java:60) at Main.BoneCP(Main.java:70) at Main.main(Main.java:24) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)

Any help or expertise would be appreciated.

Eazy-E
  • 33
  • 1
  • 7

1 Answers1

1

The class you are missing is in the slf4j-api jar, currently at version slf4j-api-1.7.5.jar. You can get it here. Add it to your build path and remove the one you have slf4j-jdk14 if you are on java version > 1.4.

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
  • Thank you. Using the proper JAR file fixed the issue. – Eazy-E Apr 11 '13 at 20:17
  • @Eazy-E You're welcome. For future reference, you could use a site like http://www.findjar.com/index.x to find jars containing the class you get ClassNotFound or NoClassDef errors on. – Sotirios Delimanolis Apr 11 '13 at 20:18
  • Thanks for the tip, it's been awhile since I have written any java. – Eazy-E Apr 11 '13 at 20:49
  • 1
    The slf4j ecology is not trivial to manage. I have seen lots of libraries that explicitly bring in Maven dependencies on specific versions of log4j, slf4j, and other logging systems, and I have had problems excluding incorrect versions. I've also seen fellow developers include specific loggers in their own projects that fit into mine. Remember to use the right slf4j bridge jars when necessary: jcl-over-slf4j, for example. – Eric Jablow Apr 11 '13 at 21:29
  • That's a very good point. I don't think he's using Maven, though. – Sotirios Delimanolis Apr 11 '13 at 21:33