Migrating to Lagom 1.4.x?

Introduction To Lagom Framework
Reading Time: 2 minutes

Hi, In this blog we will discuss some of the challenges we faced while migrating lagom version from 1.3.x to 1.4.x that can be helpful if you are thinking to migrate your lagom version. But firstly we will see the versions we should have for Scala, Play and Akka.

Play and Akka Versions

While migrating Play and Akka version too needs to upgrade. With Lagom 1.4.x Play version should be 2.6.x and Akka version should be 2.5.x.

Scala Version

Also, Scala version needs to upgraded to 2.12.x corresponding to the version upgrade for Lagom.

Sbt Conductr Version

If using sbt-conductr in your project you need to upgrade the version to 2.5.1 or later.

Deprecated Stuff

  • Binding Services:

Earlier we were binding service in lagom using the following method which has been deprecated now in 1.4.x:

lazy val lagomServer = LagomServer.forServices(bindService[Service].to(wire[ServiceImpl]))

which has been replaced with:

lazy val lagomServer = serverFor[Service](wire[ServiceImpl])
  • Configuration API:

If you are using play.Configuration to load configuration from your application.conf then, it is time to switch to com.typesafe.config.Config as play.Configuration has been deprecated in Lagom 1.4.x.

  • Transitive Dependencies:

Whenever you knock down with such an error:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/Product$class
at play.api.Configuration.<init>(Configuration.scala:175)
at play.api.Configuration$.load(Configuration.scala:100)
at play.core.server.ProdServerStart$.readServerConfigSettings(ProdServerStart.scala:86)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:40)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Caused by: java.lang.ClassNotFoundException: scala.Product$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 6 more

view raw
hosted with ❤ by GitHub

It can be that some dependencies are still using the old version of scala transitively which you can check using the dependency tree command :


mvn dependency:tree


sbt "inspect tree clean"

So, you can exclude those transitive dependencies after figuring out the same from the dependency tree.

  • FasterXml Jackson Exception:

If you are using Jackson dependency with Lagom you need to have below dependencies with the same version:

  • jackson-core
  • jackson-databind
  • jackson-annotations

Otherwise, you will face the exception mentioned below:

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonInclude$Value
at com.fasterxml.jackson.databind.cfg.MapperConfig.(MapperConfig.java:45)
at com.fasterxml.jackson.databind.ObjectMapper.(ObjectMapper.java:535)
at com.fasterxml.jackson.databind.ObjectMapper.(ObjectMapper.java:452)
at com.allianz.cmis.util.ApacheHttpClientGet.main(ApacheHttpClientGet.java:65)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonInclude$Value
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) … 4 more

view raw
hosted with ❤ by GitHub

  • Akka Warning:

Also, it can be that you are getting some kind of Akka warning while trying to deploy on DC/OS:

WARN akka.actor.ActorSystemImpl – Illegal request, responding with status '400 Bad Request': Request is missing required `Host` header: Cannot establish effective URI of request, request has a relative URI and is missing a `Host` header; consider setting `akka.http.server.default-host-header`

view raw
hosted with ❤ by GitHub

In that case, there is a solution for that you need to provide a configuration in your application.conf:

play.server.akka.default-host-header = "www.localhost.com"


There are various other changes you need to do while migrating to Lagom 1.4.x version according to your use case and scenario. Just shared some major challenges faced while migrating Lagom version. Hope it helped!! 🙂


Written by 

Charmy is a Software Consultant having experience of more than 1.5 years. She is familiar with Object Oriented Programming Paradigms and has familiarity with Technical languages such as Scala, Lagom, Java, Apache Solr, Apache Spark, Apache Kafka, Apigee. She is always eager to learn new concepts in order to expand her horizon. Her hobbies include playing guitar and Sketching.