yahoo / CMAK

CMAK is a tool for managing Apache Kafka clusters
Apache License 2.0
11.73k stars 2.5k forks source link

JS & CSS no longer load when running under Java 16 #844

Open pennello opened 3 years ago

pennello commented 3 years ago

It looks like access to some classes that was previously legal has become illegal!

2021-05-20 14:16:45.080 PDT
! @7jn3njc8f - Internal server error, for (GET) [/assets/dataTables/javascripts/dataTables.bootstrap4.js] ->
2021-05-20 14:16:45.080 PDT
2021-05-20 21:16:45,078 - [ERROR] application -
2021-05-20 14:16:45.080 PDT
play.api.UnexpectedException: Unexpected exception[RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x549621f3) 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 @0x549621f3] at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:247) at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:178) at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:382) at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:380) at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x549621f3) 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 @0x549621f3 at play.api.mvc.ActionBuilder$$anon$10.apply(Action.scala:424) at play.api.mvc.Action.$anonfun$apply$2(Action.scala:96) at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:174) at scala.util.Try$.apply(Try.scala:213) at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:174) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:207) at play.api.libs.streams.FlattenedAccumulator.$anonfun$run$2(Accumulator.scala:231) Caused by: java.lang.IllegalAccessError: class play.utils.Resources$ (in unnamed module @0x549621f3) 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 @0x549621f3 at play.utils.Resources$.isUrlConnectionADirectory(Resources.scala:32) at controllers.AssetsBuilder.$anonfun$assetAt$3(Assets.scala:817) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70) at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:72) at scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallback(Promise.scala:316) at scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:307) at scala.concurrent.impl.Promise.transformWith(Promise.scala:40)

This results in the JS & CSS not loading and the UI looking less than perfect.

Screen Shot 2021-05-20 at 2 22 10 PM

Our current workaround is to include Java arguments

--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED
--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED

when running CMAK. But this is of course not ideal, nor guaranteed to continue working in future Java releases.

Please let me know if I can provide any further information to help debug this.

MaximGurschi commented 3 years ago

@pennello Having the same issue, and can confirm your workaround works.

halpert3 commented 1 year ago

I'm having the same issues. Could someone provide the full commands for these workarounds and also the correct folder to run the commands in?

karavayeu commented 1 year ago

@halpert3 From the cmak -h:

# jvm options and output control
  JAVA_OPTS          environment variable, if unset uses ""
  -Dkey=val          pass -Dkey=val directly to the java runtime
  -J-X               pass option -X directly to the java runtime
                     (-J is stripped)

The full command will be: cmak -J--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED -J--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED

spade69 commented 1 year ago

@halpert3 From the cmak -h:

# jvm options and output control
  JAVA_OPTS          environment variable, if unset uses ""
  -Dkey=val          pass -Dkey=val directly to the java runtime
  -J-X               pass option -X directly to the java runtime
                     (-J is stripped)

The full command will be: cmak -J--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED -J--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED

yep , this method fix my problem, my java version is 20

Zhang21 commented 1 month ago

jdk 15 ok

cmak -java-home /opt/jdk-15.0.1
pennello commented 1 month ago

For what it's worth, we've migrated off of CMAK and onto having our individual developers use a desktop GUI tool called Franz in addition to local and/or remote kcat runs.