Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item #12630

Closed
anitha1729 opened this issue May 10, 2024 · 12 comments

Comments

@anitha1729
Copy link

anitha1729 commented May 10, 2024

We are using Play 2.8.16, sbt 1.9.6, scala 2.13.13 and jdk 17. We are able to successfully compile and run the application. We see below on the console.

--- (Running the application, auto-reloading is enabled) ---
(Server started, use Enter to stop and go back to the console...)

But once we hit http://localhost:9000/, we are getting error. UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item.

We also tried adding **JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-exports java.base/sun.security.util=ALL-UNNAMED --add-exports java.base/sun.security.x509=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED", **
but it didn't work.

Also tried with play 2.9.2, but no luck, getting the same error

Please find the below stack trace
No source available, here is the exception stack trace:

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item
     com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2055)
     com.google.common.cache.LocalCache.get(LocalCache.java:3966)
     com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989)
     com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950)
     com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4956)
     com.google.inject.internal.FailableCache.get(FailableCache.java:54)
     com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
     com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:155)
     com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:592)
     com.google.inject.internal.AbstractBindingProcessor$Processor.initializeBinding(AbstractBindingProcessor.java:173)
     com.google.inject.internal.AbstractBindingProcessor$Processor.lambda$scheduleInitialization$0(AbstractBindingProcessor.java:160)
     com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:49)
     com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:124)
     com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:108)
     com.google.inject.Guice.createInjector(Guice.java:87)
     com.google.inject.Guice.createInjector(Guice.java:78)
     play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)
     play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
     play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
     play.core.server.DevServerStart$$anon$1.$anonfun$reload$2(DevServerStart.scala:193)
     play.utils.Threads$.withContextClassLoader(Threads.scala:22)
     play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:185)
     play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:148)
     play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:308)
     play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:225)
     akka.stream.impl.fusing.MapAsync$$anon$29.onPush(Ops.scala:1308)
     akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:554)
     akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:508)
     akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:400)
     akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:650)
     akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:521)
     akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:625)
     akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:800)
     akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:818)
     akka.actor.Actor.aroundReceive(Actor.scala:537)
     akka.actor.Actor.aroundReceive$(Actor.scala:535)
     akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:716)
     akka.actor.ActorCell.receiveMessage(ActorCell.scala:579)
     akka.actor.ActorCell.invoke(ActorCell.scala:547)
     akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
     akka.dispatch.Mailbox.run(Mailbox.scala:231)
     akka.dispatch.Mailbox.exec(Mailbox.scala:243)
     java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
     java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
     java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
     java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
     java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
@mkurz
Copy link
Member

mkurz commented May 10, 2024

Play 2.8 does not support Java 17 out of the box, you need to upgrade guice yourself to make it work, see this guide:
https://github.com/playframework/playframework/releases/tag/2.8.15#user-content-java17

If you say you also tried with Play 2.9.2, did you run sbt clean before or remove the target folder before?
I am pretty sure Play 2.9.2 with Java 17 works well.

@anitha1729
Copy link
Author

yeah, I did try deleting the target folder and did sbt clean before compile

@mkurz
Copy link
Member

mkurz commented May 10, 2024

Can you post your build.sbt and project/plugins.sbt? And/or run sbt dependencyTree so we find out which dependencies get pull in?

@anitha1729
Copy link
Author

Can you please let me know what is the guice version while using paly 2.9.2?
Currently it is "com.google.inject" % "guice" % "4.2.3",

@mkurz
Copy link
Member

mkurz commented May 10, 2024

When using Play 2.9.2 you do not have to add guice yourself. Just make sure you have libraryDependencies += guice then Guice 6.0 will be pulled in automatically from Play itself.

@anitha1729
Copy link
Author

@mkurz
Copy link
Member

mkurz commented May 10, 2024

Let me know if it works, so we can close this issue, thanks!

@anitha1729
Copy link
Author

It didn't work, I still see the same exception
image

@mkurz
Copy link
Member

mkurz commented May 10, 2024

So, in the logs you posted you still use Play 2.8.16.
If you want to use Ply 2.8 and Java 17 you have to add following dependencies listed here: https://github.com/playframework/playframework/releases/tag/2.8.15#user-content-java17

Just add

  // In your build.sbt add:
  libraryDependencies ++= Seq(
    "com.google.inject"            % "guice"                % "5.1.0",
    "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0"
  )
 libraryDependencies += "net.jodah" % "typetools" % "0.6.3"

to your build.sbt

@anitha1729
Copy link
Author

anitha1729 commented May 10, 2024

I have changed it to 2.9.2, addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.16") this remains same, right? or should I change the plugin

@anitha1729
Copy link
Author

anitha1729 commented May 10, 2024

I have added this

 //libraryDependencies += guice
libraryDependencies ++= Seq(
  "com.google.inject"            % "guice"                % "5.1.0",
  "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0"
)
libraryDependencies += "net.jodah" % "typetools" % "0.6.3"

Got the below error:

[error] (update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/com/google/inject/guice/5.1.0/guice-5.1.0-no_aop.jar: not found: https://repo1.maven.org/maven2/com/google/inject/guice/5.1.0/guice-5.1.0-no_aop.jar

@mkurz
Copy link
Member

mkurz commented May 13, 2024

I took your config from above's comment and made it work with Play 2.9.2. I uploaded the result in to this repo https://github.com/mkurz/playframework-12630

You can see what I changed here: mkurz/playframework-12630@ea5dcc1

This is 100% not a bug in Play but you just messed up the config.

@playframework playframework locked and limited conversation to collaborators May 13, 2024
@mkurz mkurz converted this issue into discussion #12631 May 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants