Describe the bug
:wave: Hello!
I've got a freshly created Quarkus project with nothing in it but the result of the project creation.
I'm following the Getting Started guide, except that I created my project with Kotlin instead of Java.
Running the default generated test with mvn using mvn test works fine:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.worldline.tex.radar.RadarApplicationTest
2020-01-23 18:10:11,824 WARN [io.qua.agr.dep.AgroalProcessor] (build-18) Agroal dependency is present but no driver has been defined for the default datasource
2020-01-23 18:10:13,562 WARN [io.qua.config] (main) Unrecognized configuration key "quarkus.security.users.file.enabled" was provided; it will be ignored
2020-01-23 18:10:14,541 INFO [io.quarkus] (main) Quarkus 1.1.1.Final started in 1.011s. Listening on: http://0.0.0.0:8081
2020-01-23 18:10:14,542 INFO [io.quarkus] (main) Profile test activated.
2020-01-23 18:10:14,545 INFO [io.quarkus] (main) Installed features: [agroal, cdi, config-yaml, hibernate-orm, hibernate-validator, jdbc-postgresql, kotlin, narayana-jta, resteasy, resteasy-jackson, smallrye-openapi, swagger-ui]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.54 s - in com.worldline.tex.radar.RadarApplicationTest
2020-01-23 18:10:16,359 INFO [io.quarkus] (main) Quarkus stopped in 0.100s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
But when trying to run the exact same test within IntelliJ (my project being properly imported within the IDE, with the Quarkus plugin installed, and all Maven dependencies resolved), the test execution fails with the following stacktrace:
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [com.worldline.tex.radar.RadarApplicationTest]: io/quarkus/resteasy/common/spi/ResteasyJaxrsProviderBuildItem
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstanceFactory(ClassBasedTestDescriptor.java:300)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:275)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:77)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:258)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:252)
at java.base/java.util.Optional.orElseGet(Optional.java:362)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:251)
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:29)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:106)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:105)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:69)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:107)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:107)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:75)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.NoClassDefFoundError: io/quarkus/resteasy/common/spi/ResteasyJaxrsProviderBuildItem
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:416)
at io.quarkus.deployment.util.ServiceUtil.classesNamedIn(ServiceUtil.java:31)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:206)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:133)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:88)
at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:114)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:249)
at io.quarkus.test.junit.QuarkusTestExtension.createTestInstance(QuarkusTestExtension.java:394)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstanceFactory(ClassBasedTestDescriptor.java:285)
... 47 more
Caused by: java.lang.ClassNotFoundException: io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 57 more
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/antoine/.m2/repository/org/codehaus/groovy/groovy/2.5.8/groovy-2.5.8.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Process finished with exit code 255
Expected behavior
I would expect the tests to succeed in IntelliJ the same way they succeed with Maven.
Actual behavior
The tests are running fine with Maven, but are failing with the error mentionned above while running them in IntelliJ.
To Reproduce
Steps to reproduce the behavior:
mvn test (it should work)Configuration
# Add your application.properties here, if applicable.
nothing in that file
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a or ver: Linux 5.4.13-arch1-1 #1 SMP PREEMPT Fri, 17 Jan 2020 23:09:54 +0000 x86_64 GNU/Linuxjava -version: openjdk version "13.0.1" 2019-10-15Additional context
Thank you very much for your help!
You closed the issue. Did you found out the solution?
I am having a similar problem and would like to know how did you solve it.
Thank you
Hello :)
I didn't solve the issue, but figured out the problem was also occuring with the Java examples. I tried on another PC, and looks like the combo: latest Java version + latest IntelliJ version with Quarkus 1.1.1.Final leads to tests failing in IntelliJ (but not in Maven).
Since it's apparently not related to Kotlin, I thought I'd close the issue to avoid misleading report.
I have the same problem. I had to add the following to the pom in order to have the tests run under IntelliJ
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-common-spi</artifactId>
<version>1.2.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-spi</artifactId>
<version>1.2.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow-deployment</artifactId>
<version>1.2.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-server-common-spi</artifactId>
<version>1.2.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health-spi</artifactId>
<version>1.2.0.Final</version>
<scope>test</scope>
</dependency>
I tried that dependencies and it worked. But now I am getting java.lang.ClassNotFoundException: io.quarkus.undertow.deployment.StaticResourceFilesBuildItem
I tried to find StaticResourceFilesBuildItem in the quarkus code but it does not exist
Most helpful comment
I have the same problem. I had to add the following to the pom in order to have the tests run under IntelliJ