将spring引导应用程序部署到关键云Foundry失败,错误如下。实例的限制设置为2GB,然后设置为4GB。本地应用程序启动良好,堆大小为2GB。应用程序在缓存管理器初始化期间失败。知道根本原因是什么吗?不知道兵马俑在云铸造中扮演了什么角色,还需要寻找什么呢?
2019-05-07T19:24:53.39+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2019-05-07T19:24:53.39+0530 [APP/PROC/WEB/0] OUT Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.cache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is org.ehcache.StateTransitionException: Cache '<name hidden>' creation in EhcacheManager failed.
....
Caused by: java.lang.IllegalArgumentException: An attempt was made to allocate more off-heap memory than the JVM can allow. The limit on off-heap memory size is given by the -XX:MaxDirectMemorySize command (or equivalent).
2019-05-07T19:15:13.15+0530 [APP/PROC/WEB/0] OUT at org.terracotta.offheapstore.paging.UpfrontAllocatingPageSource.bufferAllocation(UpfrontAllocatingPageSource.java:564)
2019-05-07T19:15:13.15+0530 [APP/PROC/WEB/0] OUT at org.terracotta.offheapstore.paging.UpfrontAllocatingPageSource.lambda$allocateBackingBuffers$1(UpfrontAllocatingPageSource.java:513)
2019-05-07T19:15:13.15+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2019-05-07T19:15:13.15+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2019-05-07T19:15:13.15+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2019编辑:通过删除堆外ehcache配置:修复了:maxBytesLocalOffHeap
发布于 2019-05-08 13:22:47
默认情况下,将约束JVM的各种内存区域。它这样做是为了确保Java应用程序不会超过容器的内存限制,这将导致应用程序崩溃。
您的应用程序正在尝试创建超过Java设置的限制的直接内存数量。在我编写这篇文章时,Java正在设置-XX:MaxDirectMemorySize=10M。
要做到这一点,只需在manifest.yml或cf set-env中设置一个环境变量,称为JAVA_OPTS,内容需要包含-XX:MaxDirectMemorySize=XXM,其中XX是您想要使用的更大的值。
当您像这样调整内存设置时,Java将看到,并将减少其他内存区域的大小以进行补偿。如果您试图使用大量的直接内存,这可能会导致您没有足够的内存给其他区域。如果发生这种情况,则需要增加应用程序的总体内存限制。
希望这能帮上忙!
https://stackoverflow.com/questions/56037081
复制相似问题