我正在做一个项目,它的大部分Junit都失败了。我的工作是修理它们并让它们运行。我已经修正了大约200个Junit类,但是仍然有大约136个Junit失败,原因是不知道,有时它们会失败,有些会工作。试着钻研这个问题,它就是ehCache。它被关闭了。
Can any body please explain me why this exception occur in Junt testing and that to not all the time.
Please Note we have test cases for "Action" classes as well(Which deal with Servlet Context)
But interesting point all action test classes are getting passed.
Error Message is :
java.lang.IllegalStateException: The CacheManager has been shut down. It can no longer be used.
at net.sf.ehcache.CacheManager.checkStatus(CacheManager.java:1504)
at net.sf.ehcache.CacheManager.getCacheNames(CacheManager.java:1491)
at net.sf.ehcache.CacheManager.clearAll(CacheManager.java:1526)发布于 2014-02-10 09:30:18
我知道出了什么问题。其中一个Junit需要时间来完成,这是一个DAO。该方法大约需要40到50分钟才能完成,而缓存管理器发生时会话超时,而当其他Junit试图访问时,我将得到该错误。我修正了Junit,这基本上意味着对DAO的查询运行得更快,而且一切都很好。
发布于 2014-02-07 12:34:19
代码的某些部分是关闭缓存管理器(可能是在单元测试的拆卸中),然后试图清除缓存。您可以在堆栈跟踪中看到这一点:
at net.sf.ehcache.CacheManager.clearAll(CacheManager.java:1526)但是,一旦管理器关闭,您就不能调用对它的操作。如果没有看到其中一个单元测试的代码,就很难更加具体。
https://stackoverflow.com/questions/21627479
复制相似问题