File upload via play - with Lagom 1.5.0-M4

java

(Michael Mangeng) #1

Hi all!

i’ve implemented a file-storage service where the file-metadata is handled via a lagom sevice and stored in elastic-search.
The file-data itself can be up-/downloaded via a play controller.
Basically the same as in: https://github.com/lagom/lagom-recipes/tree/master/file-upload/file-upload-java-sbt

If i start the service via sbt runAll, everything is working as expected.
When i create a universal - build (via m2m-filestore-impl/universal:packageBin), unpack and start the app, i get the exception below.

Looks like it does not find play.Configuration - but all deps have been generated by sbt and its running in dev-mode ?!?

EDIT: I’m not using play.Configuration anywhere… i’m only using com.typesafe.Config

Lagom Version 1.5.0-M4
plugins.sbt:

addSbtPlugin(“com.lightbend.lagom” % “lagom-sbt-plugin” % “1.5.0-M4”)
addSbtPlugin(“com.typesafe.sbteclipse” % “sbteclipse-plugin” % “5.2.4”)
addSbtPlugin(“com.typesafe.sbt” % “sbt-native-packager” % “1.3.4”)
addSbtPlugin(“com.lightbend.rp” % “sbt-reactive-app” % “1.1.0”)

build.sbt:

import sbt.Keys.dependencyOverrides

organization in ThisBuild := “biz.example”
version in ThisBuild := “0.0.30-SNAPSHOT”
scalaVersion in ThisBuild := “2.12.4”

isSnapshot in ThisBuild := true

val eurekaClient = “me.sutii.lagom” % “eureka-client” % “0.0.1-SNAPSHOT”
val lombok = “org.projectlombok” % “lombok” % “1.16.18”
val m2m_search = “biz.example.m2m” %% “m2m-search” % “0.0.30-SNAPSHOT”
val m2m_tools = “biz.example.m2m” %% “m2m-tools” % “0.0.30-SNAPSHOT”
val m2m_security = “biz.example.m2m” %% “m2m-security” % “0.0.30-SNAPSHOT”

enablePlugins(JavaAppPackaging)

def common = Seq(
javacOptions in compile += “-parameters”
)

lagomKafkaEnabled in ThisBuild := false
lagomCassandraEnabled in ThisBuild := false

lagomUnmanagedServices in ThisBuild := Map()
lagomUnmanagedServices in ThisBuild += (“elasticsearch-fileindex” -> “http://localhost:9200”)

lazy val m2m-filestore = (project in file("."))
.aggregate(m2m-filestore-api, m2m-filestore-impl)

lazy val m2m-filestore-api = (project in file(“m2m-filestore-api”))
.settings(common: _*)
.settings(
libraryDependencies ++= Seq(
lagomJavadslApi,
m2m_tools,
lombok
)
)

lazy val m2m-filestore-impl = (project in file(“m2m-filestore-impl”))
.enablePlugins(LagomJava, PlayJava)
.disablePlugins(PlayLayoutPlugin)
.settings(common: _)
.settings(
routesGenerator := InjectedRoutesGenerator
)
.settings(
libraryDependencies ++= Seq(
lagomJavadslTestKit,
m2m_search,
m2m_security,
eurekaClient
)
)
.settings(lagomForkedTestSettings: _
)
.dependsOn(m2m-filestore-api)

Exception:

Oops, cannot start the server.
com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: play/Configuration
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2048)
at com.google.common.cache.LocalCache.get(LocalCache.java:3952)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964)
at com.google.inject.internal.FailableCache.get(FailableCache.java:51)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:155)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:595)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:932)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:852)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:291)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:222)
at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:938)
at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:48)
at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:60)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:78)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:186)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:139)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:82)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:42)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Caused by: java.lang.NoClassDefFoundError: play/Configuration
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:115)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:706)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:930)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:852)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:291)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:222)
at com.google.inject.internal.InjectorImpl.createParameterInjector(InjectorImpl.java:991)
at com.google.inject.internal.InjectorImpl.getParametersInjectors(InjectorImpl.java:978)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:69)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at com.google.inject.internal.FailableCache$1.load(FailableCache.java:40)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3528)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2277)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044)
… 26 more
Caused by: java.lang.ClassNotFoundException: play.Configuration
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 47 more


(Michael Mangeng) #2

Sorry - the lib which included the deprecated api was from one of my own dependencies.
Topic closed.