Migrating to Lagom 1.4.x?

Introduction To Lagom Framework

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:

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

Maven:

mvn dependency:tree

Sbt:

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:

  • Akka Warning:

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

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"

Conclusion

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!! 🙂


knoldus-advt-sticker

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.

Leave a Reply

%d bloggers like this: