解决Nexus3.xx版本的内存问题(1核1G内存不行,内存必须得2G,亲测有效)

解决Nexus3.xx版本的内存问题

楼主买了个1核1G的云服务器,准备搭建一个私服用一用,谁知竟然启动报错。

查看运行状态
说的很清楚,说我的内存不足。

ubuntu@10-9-17-59:~/Develop/Nexus/nexus-3.15.2-01/bin$ ./nexus status
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f046d000000, 2555904, 1) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/ubuntu/Develop/Nexus/nexus-3.15.2-01/hs_err_pid1819.log

一、解决办法

1.查看怎么修改

修改Nexus 的内存配置

Nexus官方给出的修改方案

2.找到目标文件

ubuntu@10-9-17-59:~/Develop/Nexus/nexus-3.15.2-01/bin$ ls
contrib  nexus  nexus.rc  nexus.vmoptions
ubuntu@10-9-17-59:~/Develop/Nexus/nexus-3.15.2-01/bin$ 

3.编辑它

-Xms128M
-Xmx128M
-XX:MaxDirectMemorySize=256M

4.启动

经过测试1核1G是启动成功不了的,纵使修改了,也没办法,必须得2G内存。

报错:

2019-04-03 16:45:53,865+0800 WARN  [jetty-main-1] *SYSTEM org.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@56eef120{Sonatype Nexus,/,file:///home/ubuntu/Develop/Nexus/nexus-3.15.2-01/public/,UNAVAILABLE}
java.lang.OutOfMemoryError: Java heap space
	at org.apache.felix.resolver.util.CandidateSelector.copy(CandidateSelector.java:45)
	at org.apache.felix.resolver.util.OpenHashMapList.deepClone(OpenHashMapList.java:39)
	at org.apache.felix.resolver.Candidates.copy(Candidates.java:1143)
	at org.apache.felix.resolver.Candidates.permutate(Candidates.java:1196)
	at org.apache.felix.resolver.ResolverImpl$ResolveSession.permutateIfNeeded(ResolverImpl.java:134)
	at org.apache.felix.resolver.Candidates.checkSubstitutes(Candidates.java:344)
	at org.apache.felix.resolver.ResolverImpl.checkConsistency(ResolverImpl.java:562)
	at org.apache.felix.resolver.ResolverImpl.findValidCandidates(ResolverImpl.java:530)
	at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:393)
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:375)
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:368)
	at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2核2G完美运行

访问它:

你可能感兴趣的:(Git,Maven,Gradle,Nexus3,内存不足,1核1G不行,内存必须得2G)