简体   繁体   English

运行Junits时出现Java堆空间问题

[英]Java Heap Space Issue while running Junits

I have been working on upgrading an application from Spring 3 to 4 and Hibernate 3 to 4. Exact version now: Spring : 4.1.9 Hibernate: 4.3.7 我一直在致力于将应用程序从Spring 3升级到4,将Hibernate 3升级到4。现在的确切版本:Spring:4.1.9 Hibernate:4.3.7

Due to dependencies I am also having to upgrade the Junit version and we are using 4.12 now. 由于依赖关系,我还必须升级Junit版本,我们现在使用4.12。

Since the upgrade I am getting a java heap space exception for most of the unit tests: 自升级以来,对于大多数单元测试,我都遇到了Java堆空间异常:

net.sf.ehcache.CacheException: java.lang.OutOfMemoryError: Java heap space
    at net.sf.ehcache.CacheManager.init(CacheManager.java:361)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:237)
    at net.sf.ehcache.CacheManager.create(CacheManager.java:856)
    at net.sf.ehcache.CacheManager.create(CacheManager.java:743)
    at net.sf.ehcache.CacheManager.getInstance(CacheManager.java:758)
    at com.rsa.csd.RsaBaseTestCase.setUp(RsaBaseTestCase.java:144)
    at junit.framework.TestCase.runBare(TestCase.java:139)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:252)
    at junit.framework.TestSuite.run(TestSuite.java:247)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:133)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:114)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:188)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:166)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:101)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at net.sf.ehcache.store.chm.ConcurrentHashMap$HashEntry.newArray(ConcurrentHashMap.java:226)
    at net.sf.ehcache.store.chm.ConcurrentHashMap$Segment.<init>(ConcurrentHashMap.java:316)
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$MemoryStoreSegment.<init>(SelectableConcurrentHashMap.java:270)
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$MemoryStoreSegment.<init>(SelectableConcurrentHashMap.java:262)
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.createSegment(SelectableConcurrentHashMap.java:245)
    at net.sf.ehcache.store.chm.ConcurrentHashMap.<init>(ConcurrentHashMap.java:634)
    at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.<init>(SelectableConcurrentHashMap.java:52)
    at net.sf.ehcache.store.MemoryStore.<init>(MemoryStore.java:146)
    at net.sf.ehcache.store.NotifyingMemoryStore.<init>(NotifyingMemoryStore.java:37)
    at net.sf.ehcache.store.NotifyingMemoryStore.create(NotifyingMemoryStore.java:49)
    at net.sf.ehcache.store.MemoryOnlyStore.create(MemoryOnlyStore.java:69)
    at net.sf.ehcache.Cache.initialise(Cache.java:1105)
    at net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1128)
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1159)
    at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:708)
    at net.sf.ehcache.CacheManager.doInit(CacheManager.java:426)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:352)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:237)
    at net.sf.ehcache.CacheManager.create(CacheManager.java:856)
    at net.sf.ehcache.CacheManager.create(CacheManager.java:743)
    at net.sf.ehcache.CacheManager.getInstance(CacheManager.java:758)
    at com.rsa.csd.RsaBaseTestCase.setUp(RsaBaseTestCase.java:144)
    at junit.framework.TestCase.runBare(TestCase.java:139)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:252)
    at junit.framework.TestSuite.run(TestSuite.java:247)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:133)

I have tried searching online but havent been able to find any solution. 我尝试过在线搜索,但还没有找到任何解决方案。

Please let me know whatever config files I need to post. 请让我知道我需要发布的任何配置文件。

You go to the run configurations and then under arguments, you can set the vm arguments . 转到运行配置,然后在参数下设置vm arguments Within the arguments tab set VM arguments to "-Xms64m -Xmx256m" or higher depends on your system configuration. 在“参数”选项卡中,将VM参数设置为"-Xms64m -Xmx256m"或更高,具体取决于您的系统配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行mapreduce程序时出现“ Java堆空间不足内存错误” - “Java Heap space Out Of Memory Error” while running a mapreduce program 运行 rjava 时如何处理“Java Heap Space”错误 - How to deal with “Java Heap Space” error while running rjava 在Android Studio中运行Android应用程序时出现Java堆空间错误 - Java Heap Space error while running Android app in Android Studio java:OutOfMemoryError:在Idea中运行JUnits时内存不足 - java: OutOfMemoryError: insufficient memory while running JUnits in Idea JFreeChart - Java 堆空间问题 - JFreeChart - Java Heap Space issue java.lang.OutOfMemoryError: Java heap space Error while running hive table scan - java.lang.OutOfMemoryError: Java heap space Error while running hive table scan 运行简单的mapreduce作业时出现错误“ java.lang.OutOfMemoryError:Java堆空间” - Getting error “java.lang.OutOfMemoryError: Java heap space” while running simple mapreduce job Java Buffered Reader堆空间不足 - Java Buffered reader running out of heap space 获取java.lang.OutOfMemoryError:使用水槽运行Twitter连接器时的Java堆空间 - Getting java.lang.OutOfMemoryError: Java heap space while running twitter connector using flume Java中的Dijkstra算法耗尽堆空间? - The Dijkstra algorithm in java running out heap space?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM