Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pennello opened this issue May 20, 2021 · 6 comments
Open

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

pennello opened this issue May 20, 2021 · 6 comments

Comments

@pennello
Copy link

pennello commented May 20, 2021

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
Copy link

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

@halpert3
Copy link

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
Copy link

@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
Copy link

spade69 commented Apr 8, 2023

@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
Copy link

Zhang21 commented May 23, 2024

jdk 15 ok

cmak -java-home /opt/jdk-15.0.1

@pennello
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants