java.lang.NoClassDefFoundError: Could not initialize class net.sf.ehcache.hibernate.EhCacheProviderI followed the instructions in this blog entry to pretty print the classpath and confirm that ehcache.jar was indeed on the Junit test classpath. The application runs fine inside the app server, so what gives?
I solved the mystery by modifying my test so that it only ran one line of code:
System.out.println(Class.forName("net.sf.ehcache.hibernate.EhCacheProvider").newInstance());This gave me a more useful error message:
java.lang.NoClassDefFoundError: Could not initialize class org.slf4j.LoggerFactoryAha! I didn't have jboss-home/common/lib/sfl4j-api.jar on my classpath. I added it and one other slf4j jar to my classpath and my problem was solved.
There goes two hours due to a misleading error message.
No comments:
Post a Comment