Dockered Play app gives IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap

I recently posted a question about failed downloads in running a Docker play-java application. It has since been resolved by adding the particular missing dependency sisu-guice-3.1.0 in the local maven repo and mounting .m2 to the docker container.

Now the application runs very well and properly starts netty. However, problem comes when I launch the application URL http://192.168.99.100:9000 from the browser. After the compilation of scala and java sources, I see internal server error from the console and this long error is propagated to the browser:

  • Why does Docker not correctly expose my port when using -P but works with -p 80:80?
  • fluentd JSON Parser: get Messages that cannot be parsed
  • Docker compose port mapping
  • Using fs.stat to get stats from a file inside a docker container directory
  • Boot2Docker: Can't create directory: Protocol Error
  • How to derive port mappings inside a docker container?
  • java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class com.google.inject.internal.Annotations$AnnotationChecker
         com.google.inject.internal.Annotations$AnnotationChecker.<init>(Annotations.java:104)
         com.google.inject.internal.Annotations.<clinit>(Annotations.java:122)
         com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
         com.google.inject.Key.strategyFor(Key.java:339)
         com.google.inject.Key.get(Key.java:229)
         play.api.inject.guice.GuiceKey$.apply(GuiceInjectorBuilder.scala:386)
         play.api.inject.guice.GuiceableModuleConversions$$anon$1$$anonfun$configure$2$$anonfun$apply$2.apply(GuiceInjectorBuilder.scala:351)
         play.api.inject.guice.GuiceableModuleConversions$$anon$1$$anonfun$configure$2$$anonfun$apply$2.apply(GuiceInjectorBuilder.scala:347)
         scala.Option.foreach(Option.scala:257)
         play.api.inject.guice.GuiceableModuleConversions$$anon$1$$anonfun$configure$2.apply(GuiceInjectorBuilder.scala:347)
         play.api.inject.guice.GuiceableModuleConversions$$anon$1$$anonfun$configure$2.apply(GuiceInjectorBuilder.scala:344)
         scala.collection.immutable.List.foreach(List.scala:381)
         play.api.inject.guice.GuiceableModuleConversions$$anon$1.configure(GuiceInjectorBuilder.scala:344)
         com.google.inject.AbstractModule.configure(AbstractModule.java:62)
         com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
         com.google.inject.spi.Elements.getElements(Elements.java:103)
         com.google.inject.spi.Elements.getElements(Elements.java:94)
         com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:153)
         com.google.inject.AbstractModule.configure(AbstractModule.java:62)
         com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
         com.google.inject.spi.Elements.getElements(Elements.java:103)
         com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
         com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
         com.google.inject.Guice.createInjector(Guice.java:94)
         com.google.inject.Guice.createInjector(Guice.java:82)
         play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
         play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
         play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
         play.utils.Threads$.withContextClassLoader(Threads.scala:21)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
         scala.Option.map(Option.scala:146)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
         scala.util.Success.flatMap(Try.scala:231)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
         play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
         scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
         scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
         java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
         java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
         java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
         java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
         java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    

    I have been battling this issue for the past 2 days all along while trying to check all online resources.

    Most solutions I have come across involve changing certain dependencies such as upgrading guava version. However, I don’t have a direct dependency in my project on guava, neither did I reference sisu-guice anywhere so I have no control over that. I am thinking they are internal dependencies of SBT(am not sure).

    Another thing is that I can build the same project and successfully run it on my windows host without any dependency issues. I only face this after containerizing the app with docker.

    Plus why is SBT failing inside docker yet it succeeded on the host machine?

  • How to Access AWS EC2 docker tomcat instance running inside jenkins docker instance from my local browser
  • How to setting Core file size in Docker container?
  • Deploy mongodb replicaset servers with Docker on different physical servers
  • Mount “named volume” as non-root in Docker
  • How to refresh a container links
  • What is the optimal way to run a Node API in Docker on Amazon ECS?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.