解决cerebro jdk9+启动不成功问题

从github上下载完最新的cerebro-0.9.4.tgz

地址:https://github.com/lmenezes/cerebro

tar zxvf cerebro-0.9.4.tgz
cd cerebro-0.9.4
cd bin
./cerebro
Oops, cannot start the server.
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2051)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:54)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:155)
    at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:592)
    at com.google.inject.internal.AbstractBindingProcessor$Processor.initializeBinding(AbstractBindingProcessor.java:173)
    at com.google.inject.internal.AbstractBindingProcessor$Processor.lambda$scheduleInitialization$0(AbstractBindingProcessor.java:160)
    at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:49)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:124)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:108)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:78)
    at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)
    at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
    at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
    at play.core.server.ProdServerStart$.start(ProdServerStart.scala:54)
    at play.core.server.ProdServerStart$.main(ProdServerStart.scala:30)
    at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Caused by: java.lang.IllegalStateException: Unable to load cache item
    at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:79)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
    at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:258)
    at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:207)
    at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:49)
    at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:156)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:94)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:30)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:38)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:34)
    at com.google.inject.internal.FailableCache$1.load(FailableCache.java:43)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    ... 21 more
Caused by: java.lang.ExceptionInInitializerError
    at com.google.inject.internal.cglib.core.$DuplicatesPredicate.evaluate(DuplicatesPredicate.java:104)
    at com.google.inject.internal.cglib.core.$CollectionUtils.filter(CollectionUtils.java:52)
    at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:69)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
    at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:332)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
    ... 38 more
Caused by: com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4bd4bcd4
    at com.google.inject.internal.cglib.core.$ReflectUtils.defineClass(ReflectUtils.java:464)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:339)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
    at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
    at com.google.inject.internal.cglib.core.$KeyFactory$Generator.create(KeyFactory.java:221)
    at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:174)
    at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:157)
    at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:149)
    at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:145)
    at com.google.inject.internal.cglib.core.$MethodWrapper.<clinit>(MethodWrapper.java:23)
    ... 49 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4bd4bcd4
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at com.google.inject.internal.cglib.core.$ReflectUtils$1.run(ReflectUtils.java:61)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:52)
    at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
    ... 46 more

启动不成功。

错误大概是没有权限导致的。

vi cerebro

#增加--add-opens java.base/java.lang=ALL-UNNAMED
#修改前
declare -a app_mainclass=("$lib_dir/cerebro.cerebro-0.9.4-launcher.jar")
#修改后
declare -a app_mainclass=(--add-opens java.base/java.lang=ALL-UNNAMED -jar "$lib_dir/cerebro.cerebro-0.9.4-launcher.jar")

在执行./cerebro启动成功

./cerebro
[info] p.c.s.AkkaHttpServer - Stopping Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Terminating server binding for /[0:0:0:0:0:0:0:0]:9000

http://localhost:9000/ 访问,后台扔报错

! @80lplfe0a - Internal server error, for (GET) [/css/app.css] ->
 
play.api.UnexpectedException: Unexpected exception[RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:355)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:261)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:454)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b
    at play.api.mvc.ActionBuilder$$anon$9.apply(Action.scala:384)
    at play.api.mvc.Action.$anonfun$apply$4(Action.scala:82)
    at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:168)
    at scala.util.Try$.apply(Try.scala:210)
    at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:168)
Caused by: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b
    at play.utils.Resources$.isUrlConnectionADirectory(Resources.scala:36)
    at controllers.AssetsBuilder.$anonfun$assetAt$3(Assets.scala:822)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:434)
    at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
    at scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:393)
[error] p.a.h.DefaultHttpErrorHandler - 

! @80lplfe15 - Internal server error, for (GET) [/img/favicon.png] ->
 
play.api.UnexpectedException: Unexpected exception[RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:355)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:261)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:454)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b
    at play.api.mvc.ActionBuilder$$anon$9.apply(Action.scala:384)
    at play.api.mvc.Action.$anonfun$apply$4(Action.scala:82)
    at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:168)
    at scala.util.Try$.apply(Try.scala:210)
    at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:168)
Caused by: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x5f2606b) cannot access class sun.net.www.protocol.file.FileURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.file to unnamed module @0x5f2606b
    at play.utils.Resources$.isUrlConnectionADirectory(Resources.scala:36)
    at controllers.AssetsBuilder.$anonfun$assetAt$3(Assets.scala:822)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:434)
    at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
    at scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:393)

终极修改

vi cerebro

#增加--add-opens java.base/java.lang=ALL-UNNAMED
#修改前
declare -a app_mainclass=("$lib_dir/cerebro.cerebro-0.9.4-launcher.jar")
#修改后
declare -a app_mainclass=(--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar "$lib_dir/cerebro.cerebro-0.9.4-launcher.jar")

启动./cerebro

访问成功

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值