Error on starting up play 2.5.18 application

We just migrated to play 2.5.18.
The code changes are done but after upgradation the jvm is shutting down with the below mentioned error.
Any idea what this is about? It’s been a week and I have been stuck on this.

[info] play.api.Play - Application started (Dev)

Uncaught error from thread [application-akka.actor.default-dispatcher-6]: play/libs/F$Function, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[application]

java.lang.NoClassDefFoundError: play/libs/F$Function
at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
	at java.lang.Class.getDeclaredConstructors(Class.java:2020)
	at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
	at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
	at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
	at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
	at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
	at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
	at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
	at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
	at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
	at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
	at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
	at play.core.j.DefaultJavaHandlerComponents.getAction(JavaAction.scala:142)
	at play.core.j.JavaAction$$anonfun$6.apply(JavaAction.scala:91)
	at play.core.j.JavaAction$$anonfun$6.apply(JavaAction.scala:89)
	at scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:57)
	at scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:66)
	at scala.collection.mutable.ArraySeq.foldLeft(ArraySeq.scala:46)
	at play.core.j.JavaAction.apply(JavaAction.scala:89)
	at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
	at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
	at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
	at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:111)
	at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:110)
	at scala.Option.map(Option.scala:146)
	at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:110)
	at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:103)
	at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
	at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
	at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
	at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
	at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:415)
	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Looks like your code base still has references to F.Function, which if I remember correctly, is replaced (or is recommended to be replaced by) Java 8 classes. If you are sure your own code does not use the class, it is probably one of the libraries you are depending on and you will need to upgrade those to Play 2.5.18 compatible ones.

1 Like

I don’t have any reference made to it.
I guess I have upgraded all the libraries. I will recheck it once and get back.
Thanks for the response.

Same thing. All jars are updated still the same error.

Have your tried to clean your cache or remove your target directory before you compile the application?

sbt clean

Hi @asinha07,

You don’t necessarily need to have a direct reference to the dependency. sbt - and most of dependency management tools - resolves dependency in a transitive way too. So, for example, if your projects depend on a dependency A, and A depends on B, and B depends on C, then your project depends on C because of the transitive nature of dependencies. This means that your project is not explicitly declaring a dependency on an older version of Play, but it still there.

You can use sbt-dependency-graph to see the whole dependency tree and then discover which dependency is adding the older version of Play.

Best.

1 Like

Hi guys, I have resolved the issue.
I was actually using an external custom jar on top of the jars mentioned on build.sbt
That external jar was having a reference to F.Function. The issue is solved now.