每一次使用Hibernate+JUnit进行测试时,发现一个关于Java common logging的异常:
- Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
后来在网上查找资料,了解到这是Eclipse的ClassLoader与Junit的thread context ClassLoader同时装载了两个不同的org.apache.commons.log接口实现引起的,接着查到有JCLEclipse这么一个插件,但安装后没有起作用。
第二天重新操作了一遍,发现在JUnit 启动后将Reload class every run 不可勾上错误就会消失了,再看它的Tip是Use a customer class loader to reload all the classes every run,这么一来,也就不难理解了。
现在的问题是怎样在测试启动时默认将Reload class every run 不打勾。