Not able to compile the sample lagom project with JAVA11


(ramya ) #1

Hi Team ,

I’m following the example to start with the lagom service on JAVA11 .

Built the maven project from below archetype.

mvn archetype:generate -Dfilter=com.lightbend.lagom:maven-archetype-lagom-java

Lagom version used 1.5.0-M4

Changed the Maven plugin to compile the code for JAVA11 .

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

Getting the below exception .

ERROR!
com.google.inject.CreationException: Unable to create injector, see the following errors:

  1. Error in custom provider, java.lang.reflect.UndeclaredThrowableException
    at com.lightbend.lagom.javadsl.server.ServiceGuiceSupport$LagomServiceBuilder.bind(ServiceGuiceSupport.java:142) (via modules: com.google.inject.util.Modules$OverrideModule -> com.example.hello.hello.impl.HelloModule)
    while locating com.lightbend.lagom.javadsl.api.ServiceInfo
    for the 3rd parameter of com.lightbend.lagom.internal.javadsl.client.JavadslServiceClientImplementor.(JavadslServiceClientImplementor.scala:37)
    at com.lightbend.lagom.internal.javadsl.client.ServiceClientModule.bindings(ServiceClientModule.scala:13):
    Binding(class com.lightbend.lagom.internal.javadsl.client.JavadslServiceClientImplementor to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
    while locating com.lightbend.lagom.internal.javadsl.client.JavadslServiceClientImplementor
    for the 4th parameter of com.lightbend.lagom.internal.javadsl.client.ServiceClientLoader.(ServiceClientLoader.scala:15)
    at com.lightbend.lagom.internal.javadsl.client.ServiceClientModule.bindings(ServiceClientModule.scala:14):
    Binding(class com.lightbend.lagom.internal.javadsl.client.ServiceClientLoader to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
    while locating com.lightbend.lagom.internal.javadsl.client.ServiceClientLoader
    for field at com.lightbend.lagom.internal.javadsl.client.ServiceClientProvider.loader(ServiceClientLoader.scala:36)
    at com.lightbend.lagom.javadsl.client.ServiceClientGuiceSupport.bindClient(ServiceClientGuiceSupport.java:28) (via modules: com.google.inject.util.Modules$OverrideModule -> com.example.hello.hello.impl.HelloModule)

1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:178)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
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.inject.guice.GuiceBuilder.injector(GuiceBuilder.java:210)
at play.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.java:115)
at com.lightbend.lagom.javadsl.testkit.ServiceTest$.startServer(ServiceTest.scala:378)
at com.lightbend.lagom.javadsl.testkit.ServiceTest$.withServer(ServiceTest.scala:310)
at com.lightbend.lagom.javadsl.testkit.ServiceTest.withServer(ServiceTest.scala)
at com.example.hello.hello.impl.HelloServiceTest.shouldStorePersonalizedGreeting(HelloServiceTest.java:17)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.Proxy19.descriptor(Unknown Source) at com.lightbend.lagom.internal.javadsl.api.ServiceReader.readServiceDescriptor(ServiceReader.scala:44)
at com.lightbend.lagom.internal.javadsl.server.JavadslServerBuilder.$anonfun$createServiceInfo$2(JavadslServerBuilder.scala:87)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.TraversableLike.map(TraversableLike.scala:234)
at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at com.lightbend.lagom.internal.javadsl.server.JavadslServerBuilder.createServiceInfo(JavadslServerBuilder.scala:84)
at com.lightbend.lagom.internal.javadsl.server.ServiceInfoProvider.get$lzycompute(ServiceInfoProvider.scala:18)
at com.lightbend.lagom.internal.javadsl.server.ServiceInfoProvider.get(ServiceInfoProvider.scala:17)
at com.lightbend.lagom.internal.javadsl.server.ServiceInfoProvider.get(ServiceInfoProvider.scala:15)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:52)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:147)
at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:101)
at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:245)
at com.google.inject.internal.Initializer.injectAll(Initializer.java:140)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
… 39 more
Caused by: java.lang.IllegalAccessException: access to public member failed: com.example.hello.hello.api.HelloService.descriptor[Ljava.lang.Object;@58fbcb71/invokeSpecial, from com.example.hello.hello.api.HelloService/2 (unnamed module @7015ebef)
at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:942)
at java.base/java.lang.invoke.MethodHandles$Lookup.checkAccess(MethodHandles.java:2206)
at java.base/java.lang.invoke.MethodHandles$Lookup.checkMethod(MethodHandles.java:2146)
at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:2290)
at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:2283)
at java.base/java.lang.invoke.MethodHandles$Lookup.unreflectSpecial(MethodHandles.java:1798)
at com.lightbend.lagom.internal.javadsl.api.ServiceReader$ServiceInvocationHandler.invoke(ServiceReader.scala:284)
… 79 more


(Tim Moore) #2

Lagom currently requires Java 8. It’s not expected to work with Java 11 until a future version.


(ramya ) #3

Hi TimMoore ,

Thanks for confirming .

Can you let us know what would be the future version which we can expect it to work with JAVA11 .

With the existing stable release 1.4.X , can we migrate to JAVA 11 .

Thanks ,


(Tim Moore) #4

It will be a version later than 1.5.0, but we don’t have more specific details than that to share. It’s something the team will be looking at soon, but there hasn’t been a detailed investigation yet. There are also some third-party dependencies that are not yet compatible with Java 11, including Cassandra, so if you are using those components that could be an issue as well.