cassandra datastax Unexpected error while writing generated code: java.lang.NullPointerException - java

I have a java class
import com.datastax.oss.driver.api.mapper.annotations.Dao;
import com.datastax.oss.driver.api.mapper.annotations.Delete;
import com.datastax.oss.driver.api.mapper.annotations.Insert;
import com.datastax.oss.driver.api.mapper.annotations.Select;
#Dao
public interface ProductDao {
#Select
Product findById(UUID productId);
#Insert
void save(Product product);
#Delete
void delete(Product product);
}
For which I would like to use for cassandra record fetching.
I was trying the doc - https://github.com/datastax/java-driver/tree/4.x/manual/mapper
when I try building it with maven I get an NPE
ProductDao.java:[10,8] Unexpected error while writing generated code: java.lang.NullPointerException
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.util.HierarchyScanner.traverseHierarchy(HierarchyScanner.java:169)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.util.HierarchyScanner.resolveHierarchyScanStrategy(HierarchyScanner.java:97)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.util.HierarchyScanner.resolveTypeHierarchy(HierarchyScanner.java:81)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.entity.DefaultEntityFactory.getDefinition(DefaultEntityFactory.java:80)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.dao.DaoSelectMethodGenerator.generate(DaoSelectMethodGenerator.java:98)
[ERROR] at java.util.Optional.flatMap(Optional.java:241)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.dao.DaoImplementationGenerator.getContents(DaoImplementationGenerator.java:331)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.SingleFileCodeGenerator.generate(SingleFileCodeGenerator.java:43)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.MapperProcessor.processAnnotatedTypes(MapperProcessor.java:125)
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.MapperProcessor.process(MapperProcessor.java:90)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:802)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:713)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1043)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1184)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[ERROR] at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
[ERROR] at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
[ERROR] at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
[ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
[ERROR] at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:943)
[ERROR] at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:137)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Not able to root cause the error, any help is apprecitated.

This line in the stack trace and upwards starting from -
[ERROR] at com.datastax.oss.driver.internal.mapper.processor.entity.DefaultEntityFactory.getDefinition(DefaultEntityFactory.java:80)
Indicated to me that it was an issue on the entity class, not the Dao itself. With that in mind, I could replicate this stack trace by removing the #Entity annotation on the class that the Dao was to return, in your case that would be Product.
My expectation is that the Product class is not annotated correctly, we would need the code added from that class to further diagnose / confirm.

Related

playframework 2.8.8 - class sbt.internal.inc.MappedVirtualFile cannot be cast to class java.io.File

I get this error when executing sbt run.
Here are my potentially relevant version numbers.
Play Framework - 2.8.8
Scala - 2.13.6
sbt - 1.5.5
java - 11.0.13
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "6.2.0-RC3")
I read these below, but unsure if I missed anything.
https://github.com/playframework/playframework/pull/10648
https://github.com/playframework/playframework/pull/10649
https://gitter.im/sbt/sbt?at=5f6b4a01b8a99f4519a0d3ab
Any idea how to fix this?
[error] at scala.collection.TraversableOnce$folder$1$.apply(TraversableOnce.scala:187)
[error] at scala.collection.TraversableOnce$folder$1$.apply(TraversableOnce.scala:185)
[error] at scala.collection.immutable.HashMap$HashMapKeys.$anonfun$foreach$1(HashMap.scala:149)
[error] at scala.collection.immutable.HashMap$HashMap1.foreachEntry(HashMap.scala:395)
[error] at scala.collection.immutable.HashMap$HashTrieMap.foreachEntry(HashMap.scala:728)
[error] at scala.collection.immutable.HashMap$HashMapKeys.foreach(HashMap.scala:149)
[error] at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:189)
[error] at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:184)
[error] at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:108)
[error] at play.ebean.sbt.PlayEbean$.$anonfun$ebeanEnhance$1(PlayEbean.scala:113)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] at java.base/java.lang.Thread.run(Thread.java:831)
[error] (data / Compile / manipulateBytecode) java.lang.ClassCastException: class sbt.internal.inc.MappedVirtualFile cannot be cast to class java.io.File (sbt.internal.inc.MappedVirtualFile is in unnamed module of loader sbt.internal.MetaBuildLoader #130f889; java.io.File is in module java.base of loader 'bootstrap')

Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process [ERROR] Cannot instantiate class

I am migrating my project to Java 15 version. We have done all the required changes and started building a maven clean install.
I am getting the below error. Tried many from google and Github other forums, nothing working.
TestNG version changes, and some plugin changes, but no luck.
Please find below the error. Can someone help...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project quarterback: There are test failures.
[ERROR]
[ERROR] Please refer to surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com....ABCTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...DEFTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...GHITest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...JKLTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...MNOTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com...ABCTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:532)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:405)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:321)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com....DEFTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$700(ForkStarter.java:121)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:393)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:370)
[ERROR] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:832)
The thing that you see the stacktrace does not necessarily mean an error in the plugin.
I think the log with Cannot instantiate class com...ABCTest is printed by your framework, TestNG. Is the TestNG reliable in JDK 15?
You can see more in the dump files with detailed errors located in target/surefire-reports.
I found similar issue in https://sqa.stackexchange.com/questions/14680/cannot-instantiate-class-error-selenium-webdriver and the root cause looks like they called the driver
driver.findElement(...)
in the constructor of the test class.
I had a very similar problem with surefire and testng and it turned out that there was an error in the constructor of the test class that had been swallowed. My solution was to surround the whole costuctor code with try/catch and log the exception manually to find the real issue.

Maven transitive dependency issue with maven-jetty-plugin

I have a project called Animal and it have two submodules Animal-models and Animal-server. The Animal-models have a compile time dependency xyz and the Animal-server have dependency on Animal-models jar. And the Animal-server generates a war file for running on jetty server. Everything is working fine currently. With the new changes dependency xyz is removed from Animal-models project and all of a sudden the server jetty run is failing with following exception. How to find out which jar is causing the issue?
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run (default-cli) on project ccd-event-service: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run failed: A required class was missing while executing org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run: org/jboss/resteasy/plugins/guice/ModuleProcessor
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.4.8.v20171121/jetty-maven-plugin-9.4.8.v20171121.jar
[ERROR] urls[1] = file:/Users/crazyCow/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[2] = file:/Users/crazyCow/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[3] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
[ERROR] urls[4] = file:/Users/crazyCow/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
[ERROR] urls[5] = file:/Users/crazyCow/.m2/repository/org/apache/maven/maven-builder-support/3.5.0/maven-builder-support-3.5.0.jar
[ERROR] urls[6] = file:/Users/crazyCow/.m2/repository/com/google/guava/guava/20.0/guava-20.0.jar
[ERROR] urls[7] = file:/Users/crazyCow/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.0.3/maven-resolver-util-1.0.3.jar
[ERROR] urls[8] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
[ERROR] urls[9] = file:/Users/crazyCow/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[10] = file:/Users/crazyCow/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
[ERROR] urls[11] = file:/Users/crazyCow/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[12] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.24/plexus-interpolation-1.24.jar
[ERROR] urls[13] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[14] = file:/Users/crazyCow/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[15] = file:/Users/crazyCow/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[16] = file:/Users/crazyCow/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.5/maven-plugin-tools-api-3.5.jar
[ERROR] urls[17] = file:/Users/crazyCow/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[18] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-artifact-transfer/0.9.1/maven-artifact-transfer-0.9.1.jar
[ERROR] urls[19] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
[ERROR] urls[20] = file:/Users/crazyCow/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[21] = file:/Users/crazyCow/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[22] = file:/Users/crazyCow/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
[ERROR] urls[23] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-util/9.4.8.v20171121/jetty-util-9.4.8.v20171121.jar
[ERROR] urls[24] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.8.v20171121/jetty-webapp-9.4.8.v20171121.jar
[ERROR] urls[25] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.8.v20171121/jetty-xml-9.4.8.v20171121.jar
[ERROR] urls[26] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.8.v20171121/jetty-servlet-9.4.8.v20171121.jar
[ERROR] urls[27] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-quickstart/9.4.8.v20171121/jetty-quickstart-9.4.8.v20171121.jar
[ERROR] urls[28] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jaas/9.4.8.v20171121/jetty-jaas-9.4.8.v20171121.jar
[ERROR] urls[29] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-security/9.4.8.v20171121/jetty-security-9.4.8.v20171121.jar
[ERROR] urls[30] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-plus/9.4.8.v20171121/jetty-plus-9.4.8.v20171121.jar
[ERROR] urls[31] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jndi/9.4.8.v20171121/jetty-jndi-9.4.8.v20171121.jar
[ERROR] urls[32] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-server/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
[ERROR] urls[33] = file:/Users/crazyCow/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
[ERROR] urls[34] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-http/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
[ERROR] urls[35] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-io/9.4.8.v20171121/jetty-io-9.4.8.v20171121.jar
[ERROR] urls[36] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jmx/9.4.8.v20171121/jetty-jmx-9.4.8.v20171121.jar
[ERROR] urls[37] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-annotations/9.4.8.v20171121/jetty-annotations-9.4.8.v20171121.jar
[ERROR] urls[38] = file:/Users/crazyCow/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
[ERROR] urls[39] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm/6.0/asm-6.0.jar
[ERROR] urls[40] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.jar
[ERROR] urls[41] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm-tree/6.0/asm-tree-6.0.jar
[ERROR] urls[42] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.4.8.v20171121/javax-websocket-server-impl-9.4.8.v20171121.jar
[ERROR] urls[43] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.4.8.v20171121/javax-websocket-client-impl-9.4.8.v20171121.jar
[ERROR] urls[44] = file:/Users/crazyCow/.m2/repository/javax/websocket/javax.websocket-client-api/1.0/javax.websocket-client-api-1.0.jar
[ERROR] urls[45] = file:/Users/crazyCow/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[ERROR] urls[46] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.4.8.v20171121/websocket-server-9.4.8.v20171121.jar
[ERROR] urls[47] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.4.8.v20171121/websocket-common-9.4.8.v20171121.jar
[ERROR] urls[48] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.4.8.v20171121/websocket-api-9.4.8.v20171121.jar
[ERROR] urls[49] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.4.8.v20171121/websocket-client-9.4.8.v20171121.jar
[ERROR] urls[50] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-client/9.4.8.v20171121/jetty-client-9.4.8.v20171121.jar
[ERROR] urls[51] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.4.8.v20171121/websocket-servlet-9.4.8.v20171121.jar
[ERROR] urls[52] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/apache-jsp/9.4.8.v20171121/apache-jsp-9.4.8.v20171121.jar
[ERROR] urls[53] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1/jetty-schemas-3.1.jar
[ERROR] urls[54] = file:/Users/crazyCow/.m2/repository/org/mortbay/jasper/apache-jsp/8.5.23/apache-jsp-8.5.23.jar
[ERROR] urls[55] = file:/Users/crazyCow/.m2/repository/org/mortbay/jasper/apache-el/8.5.23/apache-el-8.5.23.jar
[ERROR] urls[56] = file:/Users/crazyCow/.m2/repository/org/eclipse/jdt/ecj/3.12.3/ecj-3.12.3.jar
[ERROR] urls[57] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/apache-jstl/9.4.8.v20171121/apache-jstl-9.4.8.v20171121.jar
[ERROR] urls[58] = file:/Users/crazyCow/.m2/repository/org/apache/taglibs/taglibs-standard-spec/1.2.5/taglibs-standard-spec-1.2.5.jar
[ERROR] urls[59] = file:/Users/crazyCow/.m2/repository/org/apache/taglibs/taglibs-standard-impl/1.2.5/taglibs-standard-impl-1.2.5.jar
[ERROR] urls[60] = file:/Users/crazyCow/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.jboss.resteasy.plugins.guice.ModuleProcessor
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Scope provided means that artifact is not packed within warfile, but is provided by container environment. Its typically used i.e. for servlet api.
As resteasy originates from jboss, they probably expect you to use their framework in jboss. Not in jetty. Hence default scope of the artifact seems to be "provided" - not packed in war.
But as you executed it in jetty,which is not jboss so that that it does not provide jboss jars and they are simply not there. So your "workaround" was The right thing to do.

Error running tests in Play Framework after migrating to 2.4.x (Java)

I just migrated from 2.3 to 2.4. The application itself seems to be working, but none of the tests will run. They all fail with the following error:
[error] Test models.TestCountry.createTheater failed: com.google.inject.ProvisionException: Unable to provision, see the following errors:
[error]
[error] 1) Error injecting constructor, java.lang.IllegalStateException: Got deeper than 5 levels while searching /home/jlei/workspace/ebor-play/target/web/classes/main/META-INF/resources/webjars
[error] at controllers.WebJarAssets.<init>(WebJarAssets.scala:21)
[error] at controllers.WebJarAssets.class(WebJarAssets.scala:21)
[error] while locating controllers.WebJarAssets
[error] for parameter 18 at router.Routes.<init>(Routes.scala:96)
[error] while locating router.Routes
[error] while locating play.api.test.FakeRouterProvider
[error] while locating play.api.routing.Router
[error]
[error] 1 error, took 2.828 sec
[error] at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
[error] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
[error] at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:321)
[error] at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:316)
[error] at play.api.Application$class.routes(Application.scala:111)
[error] at play.api.test.FakeApplication.routes(Fakes.scala:197)
[error] at play.api.Play$.start(Play.scala:89)
[error] at play.api.Play.start(Play.scala)
[error] at play.test.Helpers.start(Helpers.java:450)
[error] at play.test.WithApplication.startPlay(WithApplication.java:44)
[error] ...
[error] Caused by: java.lang.IllegalStateException: Got deeper than 5 levels while searching /home/jlei/workspace/ebor-play/target/web/classes/main/META-INF/resources/webjars
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:43)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.aggregateChildren(FileUrlProtocolHandler.java:47)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.listFiles(FileUrlProtocolHandler.java:36)
[error] at org.webjars.urlprotocols.FileUrlProtocolHandler.getAssetPaths(FileUrlProtocolHandler.java:25)
[error] at org.webjars.WebJarAssetLocator.getAssetPaths(WebJarAssetLocator.java:89)
[error] at org.webjars.WebJarAssetLocator.getFullPathIndex(WebJarAssetLocator.java:119)
[error] at controllers.WebJarAssets.<init>(WebJarAssets.scala:29)
[error] at controllers.WebJarAssets$$FastClassByGuice$$db4380e1.newInstance(<generated>)
[error] at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
[error] at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
[error] at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
[error] at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
[error] at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[error] at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
[error] at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
[error] at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
[error] at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
[error] at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
[error] at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
[error] at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
[error] at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
[error] at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
[error] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
[error] at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:321)
[error] at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:67)
[error] at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:67)
[error] at scala.Option.fold(Option.scala:158)
[error] at play.api.inject.RoutesProvider.get$lzycompute(BuiltinModule.scala:67)
[error] at play.api.inject.RoutesProvider.get(BuiltinModule.scala:63)
[error] at play.api.test.FakeRouterProvider.get$lzycompute(Fakes.scala:259)
[error] at play.api.test.FakeRouterProvider.get(Fakes.scala:259)
[error] at play.api.test.FakeRouterProvider.get(Fakes.scala:258)
[error] at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
[error] at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
[error] at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
[error] at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
[error] at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
[error] at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
[error] ... 44 more
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
I am using the InjectedRoutesGenerator and version 2.4.0-M3-1 of webjars-play. Let me know if there are any other details that might help!
Does anybody have any idea what might be going on?
EDIT:
Dug this up: https://github.com/sbt/sbt-web/issues/104
So seems to be a known issue. Guess I'll be trying to find a creative workaround in the meantime...
The proximate cause of the failure is that there are more than 5 levels of subdirectories under:
/home/jlei/workspace/ebor-play/target/web/classes/main/META-INF/resources/webjars
See this source file for the source of the error.
This was a problem in sbt-web. They've increased the limit: https://github.com/sbt/sbt-web/issues/104
I've solved this issue in tests by mocking up the WebJarAssets class. Basic fake application creation code in the test class that extends OneAppPerSuite or OneAppPerTest can look like the following:
implicit override lazy val app: Application = new GuiceApplicationBuilder()
.in(Environment(new File("."), this.getClass.getClassLoader, Mode.Test))
.bindings(bind[WebJarAssets].toInstance(mock[WebJarAssets]))
.build
Here I also mixed in the org.scalatest.mock.MockitoSugar trait in order to use mock method.
I'm not sure it is the case for functional tests where you need fully constructed application where WebJarAssets can be used.

Why is a lambda expression breaking guice error handling when i try to start jetty?

I face the following problem where i try to start jetty, i get the following exeption:
Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
[ERROR] org.apache.maven.surefire.testset.TestSetFailedException: java.lang.RuntimeException: com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 51966
[ERROR] at org.apache.maven.surefire.common.junit4.JUnit4RunListener.rethrowAnyTestMechanismFailures(JUnit4RunListener.java:206)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:114)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[ERROR] Caused by: java.lang.RuntimeException: com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 51966
[ERROR] at org.apache.maven.surefire.junitcore.TestSet.replay(TestSet.java:100)
[ERROR] at org.apache.maven.surefire.junitcore.ConcurrentRunListener.testSetCompleted(ConcurrentRunListener.java:82)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreRunListener.testRunFinished(JUnitCoreRunListener.java:73)
[ERROR] at org.junit.runner.notification.RunNotifier$2.notifyListener(RunNotifier.java:95)
[ERROR] at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:61)
[ERROR] at org.junit.runner.notification.RunNotifier.fireTestRunFinished(RunNotifier.java:92)
[ERROR] at org.junit.runner.JUnitCore.run(JUnitCore.java:161)
[ERROR] at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113)
[ERROR] ... 6 more
[ERROR] Caused by: com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 51966
[ERROR] at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
[ERROR] at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
[ERROR] at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
[ERROR] at com.google.inject.internal.util.$StackTraceElements.forMember(StackTraceElements.java:53)
[ERROR] at com.google.inject.internal.Errors.formatInjectionPoint(Errors.java:716)
[ERROR] at com.google.inject.internal.Errors.formatSource(Errors.java:678)
[ERROR] at com.google.inject.internal.Errors.format(Errors.java:555)
[ERROR] at com.google.inject.CreationException.getMessage(CreationException.java:48)
[ERROR] at java.lang.Throwable.getLocalizedMessage(Throwable.java:391)
[ERROR] at java.lang.Throwable.toString(Throwable.java:480)
[ERROR] at java.lang.String.valueOf(String.java:2979)
[ERROR] at java.io.PrintWriter.println(PrintWriter.java:754)
[ERROR] at java.lang.Throwable$WrappedPrintWriter.println(Throwable.java:764)
[ERROR] at java.lang.Throwable.printStackTrace(Throwable.java:655)
[ERROR] at java.lang.Throwable.printStackTrace(Throwable.java:721)
[ERROR] at org.junit.runner.notification.Failure.getTrace(Failure.java:71)
[ERROR] at org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter.writeTraceToString(JUnit4StackTraceWriter.java:57)
[ERROR] at org.apache.maven.surefire.booter.ForkingRunListener.encode(ForkingRunListener.java:330)
[ERROR] at org.apache.maven.surefire.booter.ForkingRunListener.encode(ForkingRunListener.java:312)
[ERROR] at org.apache.maven.surefire.booter.ForkingRunListener.toString(ForkingRunListener.java:258)
[ERROR] at org.apache.maven.surefire.booter.ForkingRunListener.testError(ForkingRunListener.java:132)
[ERROR] at org.apache.maven.surefire.junitcore.TestMethod.replay(TestMethod.java:118)
[ERROR] at org.apache.maven.surefire.junitcore.TestSet.replay(TestSet.java:87)
[ERROR] ... 14 more
[ERROR] Caused by: java.lang.ArrayIndexOutOfBoundsException: 51966
[ERROR] at com.google.inject.internal.asm.$ClassReader.readUTF8(Unknown Source)
[ERROR] at com.google.inject.internal.asm.$ClassReader.readClass(Unknown Source)
[ERROR] at com.google.inject.internal.asm.$ClassReader.accept(Unknown Source)
[ERROR] at com.google.inject.internal.asm.$ClassReader.accept(Unknown Source)
[ERROR] at com.google.inject.internal.util.$LineNumbers.<init>(LineNumbers.java:62)
[ERROR] at com.google.inject.internal.util.$StackTraceElements$1.apply(StackTraceElements.java:36)
[ERROR] at com.google.inject.internal.util.$StackTraceElements$1.apply(StackTraceElements.java:33)
[ERROR] at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
[ERROR] ... 36 more
From what i've read the problem seems that lambdas break guice error handling, but still people haven't come up with a solution.
If someone knows what this is about please post comment!
This unreadable exception occurs when you have a bad configuration in one of your guice modules and you are using Java 8 lambdas and guice 3.
I have spent a lot of time with this issue. Each time, I solved the problem by upgrading to guice 4 beta. One of its features is:
Better Java8 runtime compatibility
If you use maven:
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0-beta5</version>
</dependency>
This new version will give you a clear error message and a proper stacktrace that will let you find the problem. When you have solved it, you can switch back to guice 3.0 or continue to using the 4.0-beta (which is - from what I've seen - already stable).
Edited the 2016/07/13
Note that guice 4.0 and 4.1 have been released. So you should use the latest release:
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>

Categories