java.lang.IllegalStateException: Could not find sun.misc.Unsafe while #MockK - kotlin

I'm having an issue when creating a mock using MockK.
I have tried with kotlin 1.2.* version with MockK without Kotlin 1.3 but it also didn't help.
How can I resolve this? Is this because of OpenJDK 11 of it's something else?
Java version:
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
build.gradle
buildscript {
ext {
kotlinVersion = '1.3.0-rc-190'
springBootVersion = '2.0.6.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
group 'org.group'
version '0.0.1'
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-webflux')
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.boot:spring-boot-starter-data-mongodb-reactive')
implementation('com.fasterxml.jackson.module:jackson-module-kotlin')
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
testCompile('io.mockk:mockk:1.8.9.kotlin13')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.0.0')
testImplementation('io.projectreactor:reactor-test')
testImplementation('de.flapdoodle.embed:de.flapdoodle.embed.mongo:2.1.1')
}
configurations.all {
exclude group: "org.mockito", module: "mockito-core"
}
sourceCompatibility = 11
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
test {
useJUnitPlatform()
}
HistoryClient:
interface AccountHistoryClient
Test:
#ExtendWith(MockKExtension::class)
internal class ReactiveLoadTransactionsHandlerTest {
#MockK
lateinit var historyClient: historyClient
#InjectMockKs
lateinit var handler: Handler
#Test
fun handle() {
}
}
When I run this test I get this error
io.mockk.MockKException: Can't instantiate proxy for class com.group.HistoryClient
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:28)
at io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:53)
at io.mockk.impl.annotations.JvmMockInitializer.assignMockK(JvmMockInitializer.kt:145)
at io.mockk.impl.annotations.JvmMockInitializer.initMock(JvmMockInitializer.kt:39)
at io.mockk.impl.annotations.JvmMockInitializer.initAnnotatedMocks(JvmMockInitializer.kt:22)
at io.mockk.junit5.MockKExtension.postProcessTestInstance(MockKExtension.kt:107)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$null$2(ClassTestDescriptor.java:204)
at org.junit.jupiter.engine.descriptor.JupiterTestDescriptor.executeAndMaskThrowable(JupiterTestDescriptor.java:145)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeTestInstancePostProcessors$3(ClassTestDescriptor.java:204)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeTestInstancePostProcessors(ClassTestDescriptor.java:203)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateAndPostProcessTestInstance(ClassTestDescriptor.java:189)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$1(ClassTestDescriptor.java:181)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:80)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.prepare(HierarchicalTestExecutor.java:89)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:74)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: io.mockk.proxy.MockKAgentException: Failed to subclass interface com.vegesoft.moneytracker.statistics.client.AccountHistoryClient
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:38)
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
... 64 more
Caused by: java.lang.IllegalArgumentException: Could not create type
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:140)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:161)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.subclass(SubclassInstrumentation.kt:46)
at io.mockk.proxy.jvm.ProxyMaker.subclass(ProxyMaker.kt:110)
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:35)
... 65 more
Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Unavailable.defineClass(ClassInjector.java:821)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.inject(ClassInjector.java:185)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:187)
at net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:79)
at net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4457)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.doInterceptedSubclassing(SubclassInstrumentation.kt:80)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.access$doInterceptedSubclassing(SubclassInstrumentation.kt:17)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:49)
at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:17)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:138)
... 69 more
Caused by: java.lang.IllegalStateException: Could not find sun.misc.Unsafe
at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$Disabled.initialize(ClassInjector.java:1366)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.inject(ClassInjector.java:1202)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$ForUnsafeInjection.load(ClassLoadingStrategy.java:458)
at net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:79)
at net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4457)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Indirect.make(ClassInjector.java:684)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:302)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:290)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.<clinit>(ClassInjector.java:70)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:184)
... 76 more
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)
at java.base/java.lang.Class.getMethod(Class.java:2109)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction.run(ClassInjector.java:1269)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction.run(ClassInjector.java:1257)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.<clinit>(ClassInjector.java:1136)
... 85 more

Just to follow the answer from #lukaszrys I had this exact problem with running Mockito under Java 11. I was using Gradle and adding the following to my dependencies fixed it for me:
testCompile "net.bytebuddy:byte-buddy:1.8.22"
testCompile "net.bytebuddy:byte-buddy-agent:1.8.22"

One of the included dependencies was downgrading byte-buddy to version 1.7.11 (as pointed by oleksiyp).
I have manually included byte-buddy with version 1.8.22 and it started to work.

Related

How do I get CDI to work with quarkus when using a gradle composite build?

I can't get quarkus CDI to work when using a gradle composite build
Gradle 8
Quarkus 2.16.2.Final
Here is my super simple DI code.
First, the Bean I want to inject in the library:
//file: libraries/auth/src/main/kotlin/com/bean/example/auth/AuthTokenProvider.kt
package com.bean.example.auth
import javax.enterprise.context.ApplicationScoped
#ApplicationScoped
class AuthTokenProvider() {
val myToken = "so secure"
}
Second, the service I wish to inject the bean into:
//file: services/quarkus-service/src/main/kotlin/com/bean/example/AuthTokenConsumer.kt
package com.bean.example
import com.bean.example.auth.AuthTokenProvider
import javax.enterprise.context.ApplicationScoped
#ApplicationScoped
class AuthTokenConsumer(val tokenProvider: AuthTokenProvider) {
fun main(): String {
return tokenProvider.myToken
}
}
This will fail either when trying to run the app, or when trying to run the included test
//file: services/quarkus-service/src/test/kotlin/com/bean/example/AuthTokenConsumerTest.kt
package com.bean.example
import io.quarkus.test.junit.QuarkusTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import javax.inject.Inject
#QuarkusTest
class AuthTokenConsumerTest {
#Inject lateinit var consumer: AuthTokenConsumer
#Test
fun testFn () {
assertEquals("so secure", consumer.tokenProvider.myToken)
assertEquals("so secure", consumer.main())
}
}
The test fails with the following error:
> Task :services:quarkus-service:test
AuthTokenConsumerTest > testFn() FAILED
java.lang.RuntimeException at QuarkusTestExtension.java:625
Caused by: java.lang.RuntimeException at AugmentActionImpl.java:335
Caused by: io.quarkus.builder.BuildException at Execution.java:123
Caused by: javax.enterprise.inject.spi.DeploymentException at BeanDeployment.java:1223
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException at Beans.java:440
1 test completed, 1 failed
> Task :services:quarkus-service:test FAILED
FAILURE: Build failed with an exception.
Here's the stacktrace for the error:
java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:1589)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
... 11 more
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:625)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:696)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:73)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:62)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:363)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:310)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:286)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277)
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:1589)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
... 11 more
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:222)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:592)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:640)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
... 49 more
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:1589)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
... 11 more
at io.quarkus.builder.Execution.run(Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
... 60 more
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
at java.base#19.0.1/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base#19.0.1/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base#19.0.1/java.lang.Thread.run(Thread.java:1589)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.bean.example.auth.AuthTokenProvider and qualifiers [#Default]
- java member: com.bean.example.AuthTokenConsumer():tokenProvider
- declared on CLASS bean [types=[com.bean.example.AuthTokenConsumer, java.lang.Object], qualifiers=[#Default, #Any], target=com.bean.example.AuthTokenConsumer]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
... 11 more
I have included beans.xml under META-INF, as well as ran the Jandex plugin in the build, to no avail.
Here's the project structure:
Here are the build files:
library gradle.settings.kts:
pluginManagement {
repositories {
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories { mavenCentral() }
}
// == Define the inner structure of this component ==
rootProject.name = "libraries"
include(
"auth",
)
library build.gradle.kts:
plugins {
kotlin("jvm") version "1.7.22"
`java-library`
id("org.kordamp.gradle.jandex") version "1.1.0"
}
dependencies {
implementation("io.quarkus:quarkus-arc:2.16.2.Final")
}
group = "com.bean.example"
Service gradle.settings.kts
pluginManagement {
repositories {
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories { mavenCentral() }
}
includeBuild("../libraries")
// == Define the inner structure of this component ==
rootProject.name = "services"
include(
"quarkus-service",
)
Service build.gradle.kts
plugins {
kotlin("jvm") version "1.7.22"
id("io.quarkus") version "2.16.2.Final"
id("org.kordamp.gradle.jandex") version "1.1.0"
}
dependencies {
implementation(enforcedPlatform("io.quarkus.platform:quarkus-bom:2.16.2.Final"))
implementation("com.bean.example:auth")
implementation("io.quarkus:quarkus-core:2.16.2.Final")
implementation("io.quarkus:quarkus-arc:2.16.2.Final")
implementation("io.quarkus:quarkus-kotlin:2.16.2.Final")
implementation("io.quarkus:quarkus-resteasy-reactive-jackson:2.16.2.Final")
testImplementation("io.quarkus:quarkus-junit5:2.16.2.Final")
}
group = "com.bean.example"
version = "1.0"
tasks.compileTestKotlin {
dependsOn("jandex")
}
Minimal Reproduction Repo
https://github.com/jcjolley/quakus-cdi-failure-example
Any help you can provide would be greatly appreciated. I'm trying to migrate a large project off of buildSrc to this

Databinding fails with JAXB class not found exception during compilation (using kapt)

I am following GithubBrowserSample. The only change I have made is not to use NavHostFragment. I am adding fragment at runtime but the code is not compiling and there is no such helpful error log
Application
open class SCApp : Application(), HasActivityInjector, HasServiceInjector {
#Inject
protected lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>
#Inject
protected lateinit var dispatchingServiceInjector: DispatchingAndroidInjector<Service>
override fun onCreate() {
super.onCreate()
AppInjector.init(this)
}
override fun activityInjector() = dispatchingAndroidInjector
override fun serviceInjector() = dispatchingServiceInjector
}
Activity
class IncomingLeadActivity : AppCompatActivity(), HasSupportFragmentInjector {
lateinit var binding: ActivityIncomingLeadBinding
private lateinit var incomingLeadViewModel: IncomingLeadViewModel
#Inject
lateinit var viewModelFactory: ViewModelProvider.Factory
#Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_incoming_lead)
incomingLeadViewModel = ViewModelProviders.of(this, viewModelFactory).get(IncomingLeadViewModel::class.java)
binding.viewModel = incomingLeadViewModel
binding.setLifecycleOwner(this)
supportFragmentManager
.beginTransaction()
.replace(android.R.id.content, LeadReceiverFragment.newInstance(), "")
.commit()
}
override fun supportFragmentInjector() = dispatchingAndroidInjector
}
Fragment
class LeadReceiverFragment : Fragment(), Injectable {
lateinit var binding: LeadReceiverFragmentBinding
#Inject
lateinit var viewModelFactory: ViewModelProvider.Factory
private lateinit var leadReceiverViewModel: LeadReceiverViewModel
companion object {
fun newInstance() = LeadReceiverFragment()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = DataBindingUtil.inflate(
inflater,
R.layout.lead_receiver_fragment,
container,
false
)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
leadReceiverViewModel = ViewModelProviders.of(this, viewModelFactory).get(LeadReceiverViewModel::class.java)
binding.setLifecycleOwner(viewLifecycleOwner)
binding.viewModel = leadReceiverViewModel
}
}
Error
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Internal compiler error. See log for more details
at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:15)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:135)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:152)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:147)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:87)
at org.jetbrains.kotlin.gradle.internal.KaptWithKotlincTask.compile(KaptWithKotlincTask.kt:72)
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 org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
... 31 more
Detailed Log
^
e: java.lang.IllegalStateException: failed to analyze: java.lang.reflect.InvocationTargetException
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:56)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:128)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:159)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:57)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:96)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:93)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:442)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1013)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1055)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1012)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:441)
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:564)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.reflect.InvocationTargetException
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:564)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:55)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:31)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:223)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:187)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:98)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:384)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:70)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:375)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:123)
... 30 more
Caused by: com.sun.tools.javac.processing.AnnotationProcessingError: java.lang.ExceptionInInitializerError
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:976)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:881)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(JavacProcessingEnvironment.java:110)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1202)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1311)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1250)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1149)
... 47 more
Caused by: java.lang.ExceptionInInitializerError
at android.databinding.annotationprocessor.ProcessExpressions$IntermediateV2.appendTo(ProcessExpressions.java:326)
at android.databinding.annotationprocessor.ProcessExpressions.onHandleStep(ProcessExpressions.java:117)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.runStep(ProcessDataBinding.java:212)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.access$000(ProcessDataBinding.java:197)
at android.databinding.annotationprocessor.ProcessDataBinding.doProcess(ProcessDataBinding.java:98)
at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:73)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:106)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:964)
... 53 more
Caused by: java.lang.RuntimeException: Cannot create the xml marshaller
at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.<clinit>(ResourceBundle.java:730)
... 61 more
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.<clinit>(ResourceBundle.java:725)
... 61 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
... 65 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
After changing gradle version latest one, the compiler showed different errors which helped to solve the issue. In my case, the issue occured due to Dagger version 2.17, so downgrading to 2.16 solved the issue.
Reference: https://github.com/google/dagger/issues/1245

java.lang.NoSuchMethodError when running integration test

I am having a very basic straightforward configuration as follow
--- clip ---
compile group: 'org.jboss.arquillian', name: 'arquillian-bom', version: '1.4.0.Final', ext: 'pom'
testCompile group: 'org.jboss.arquillian.junit', name: 'arquillian-junit-container', version: '1.4.0.Final'
testCompile group: 'org.jboss.arquillian.container', name: 'arquillian-weld-ee-embedded-1.1', version: '1.0.0.Final'
testCompile 'org.jboss.weld:weld-core:2.4.5.Final'
testCompile group: 'junit', name: 'junit', version: '4.11'
--- end clip ---
And this is my Test class
#RunWith(Arquillian.class)
public class TooltipGeneratorTest {
#Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addClass(XXXX.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
#Test
public void testStart() {
System.out.print("gamma");
assert true;
}
AS you see, I am not even injecting a bean inside. I am unable to run a basic arquillian test in weld-ee container.
The error I am having when running with
gradle clean test
is
<failure message="java.lang.NoSuchMethodError: org.junit.runners.model.TestClass.getAnnotatedFields()Ljava/util/List;" type="java.lang.NoSuchMethodError">java.lang.NoSuchMethodError:
Is there any missing dependency?
As mentioned in the tutorial, I have all the needed dependencies
Arquillian JUnit integration
Arquillian container adapter for the target container
Container runtime (for an embedded container)
Thanks in advance
java.lang.NoSuchMethodError:
org.junit.runners.model.TestClass.getAnnotatedFields()Ljava/util/List;
and
testCompile group: 'junit', name: 'junit', version: '4.11'
The method List<FrameworkField> TestClass.getAnnotatedFields does exist in JUnit 4, but that specific version with no arguments that Arquillian is looking for was only added in JUnit 4.12.
After hours of searching I found the solution:
Context
arquillian works perfectly with maven when this is imported
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.4.0.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
problem
writing
compile group: 'org.jboss.arquillian', name: 'arquillian-bom', version: '1.4.0.Final', ext: 'pom'
will not replace it as gradle does not import the pom artifact with scope import
solution
Fortunately, gradle new version 4.6 and up support this features. so
use gradle 4.6 and up
add this to gradle.settings (for bom support)
enableFeaturePreview('IMPROVED_POM_SUPPORT')
Full Solution
repositories {
mavenLocal()
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
// compileOnly 'javax:javaee-api:7.0'
testCompile 'org.jboss.weld:weld-core:2.4.5.Final'
// this is the BOM
testCompile 'org.jboss.arquillian:arquillian-bom:1.4.0.Final'
testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:1.4.0.Final'
testCompile group: 'org.arquillian.container', name: 'arquillian-container-chameleon', version: '1.0.0.CR2'
testCompile 'junit:junit:4.12'
and under
src/test/resources/
the file arquillian.xml
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wildfly" default="true">
<configuration>
<property name="chameleonTarget">wildfly:11.0.0.Final:managed</property>
</configuration>
</container>
</arquillian>

How to create a custom Kotlin Inspection for Intellij Idea programmatically

I want to create a plugin for Intellij Idea which provides additional inspections for Kotlin language. Following the example from official documentation for creating inspections for Java, I ended up with following code, which is not working.
Here is the link to a repository with this project: https://bitbucket.org/magycbytes/kotlin-inspections/src/master/
Links to example I followed:
docummentation page: https://www.jetbrains.org/intellij/sdk/docs/tutorials/code_inspections.html
example project: https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/comparing_references_inspection
This is the provider for inspections.
package com.magicbytes.kotlin.inspections;
import com.intellij.codeInspection.InspectionToolProvider;
import com.magicbytes.kotlin.inspections.ExampleInspection;
import org.jetbrains.annotations.NotNull;
public class ExampleProvider implements InspectionToolProvider {
#NotNull
#Override
public Class[] getInspectionClasses() {
return new Class[]{ExampleInspection.class};
}
}
This is the actual inspection subclass. For the sake of shortness it's doing nothing, but should be loaded. Note: I changed the superclass to AbstractKotlinInspection
package com.magicbytes.kotlin.inspections;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection;
public class ExampleInspection extends AbstractKotlinInspection {
#Nls
#NotNull
#Override
public String getDisplayName() {
return "Kotlin Test";
}
}
My buid.gradle file looks like this:
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.3.2'
}
group 'com.magicbytes'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
intellij {
version '2018.1.4'
plugins 'kotlin'
}
Mine plugin.xml looks like this:
<idea-plugin>
<id>com.magicbytes.kotlin.inspections</id>
<name>Plugin display name here</name>
<description></description>
<depends>org.jetbrains.kotlin</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<inspectionToolProvider implementation="com.magicbytes.kotlin.inspections.ExampleProvider"/>
</extensions>
<actions>
</actions>
</idea-plugin>
I did all the linking with plugin.xml file. But when I'm running I'm getting exception in testing IDE. Appreciate any insight. NOTE: I'm using runIde to debug the plugin.
Exception which I'm getting..
java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
com.intellij.openapi.extensions.impl.PicoPluginExtensionInitializationException: java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:96)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getExtension(ExtensionComponentAdapter.java:119)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:246)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:191)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:102)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:89)
at com.intellij.openapi.extensions.ExtensionPointName.getExtensions(ExtensionPointName.java:50)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.ensureInitialized(InspectionToolRegistrar.java:54)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.createTools(InspectionToolRegistrar.java:127)
at com.intellij.codeInspection.ex.InspectionSearchableOptionContributor.processOptions(InspectionSearchableOptionContributor.java:34)
at com.intellij.ide.ui.search.SearchableOptionPreloader.preload(SearchableOptionPreloader.java:49)
at com.intellij.openapi.application.Preloader.lambda$null$0(Preloader.java:74)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.application.Preloader.lambda$initComponent$1(Preloader.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:161)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentImplementation(ExtensionComponentAdapter.java:66)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:73)
... 21 more
Caused by: java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:158)
... 23 more
Caused by:
java.lang.RuntimeException: java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:161)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentImplementation(ExtensionComponentAdapter.java:66)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:73)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getExtension(ExtensionComponentAdapter.java:119)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:246)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:191)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:102)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:89)
at com.intellij.openapi.extensions.ExtensionPointName.getExtensions(ExtensionPointName.java:50)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.ensureInitialized(InspectionToolRegistrar.java:54)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.createTools(InspectionToolRegistrar.java:127)
at com.intellij.codeInspection.ex.InspectionSearchableOptionContributor.processOptions(InspectionSearchableOptionContributor.java:34)
at com.intellij.ide.ui.search.SearchableOptionPreloader.preload(SearchableOptionPreloader.java:49)
at com.intellij.openapi.application.Preloader.lambda$null$0(Preloader.java:74)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.application.Preloader.lambda$initComponent$1(Preloader.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: ExampleProvider PluginClassLoader[com.magicbytes.kotlin.inspections, 1.0-SNAPSHOT] com.intellij.ide.plugins.cl.PluginClassLoader#6f989177
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:158)
... 23 more
After I've imported your GitHub repo and built it locally I've found out that ./build/libs/kotlin.inspections-1.0-SNAPSHOT.jar includes META-INF only, but no classes. I suspect it's because your source code is located under ./src/main/src, not ./src/main/java as it's typical for Gradle projects, so it simply assumes you have no code at all.
After renaming that inner src directory into java the error changed to
class com.magicbytes.kotlin.inspections.ExampleInspection: group display name should be overridden or configured via XML class com.magicbytes.kotlin.inspections.ExampleInspection
java.lang.Throwable: class com.magicbytes.kotlin.inspections.ExampleInspection: group display name should be overridden or configured via XML class com.magicbytes.kotlin.inspections.ExampleInspection
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:123)
at com.intellij.codeInspection.InspectionProfileEntry.getGroupDisplayName(InspectionProfileEntry.java:230)
at com.intellij.codeInspection.InspectionProfileEntry.getGroupPath(InspectionProfileEntry.java:239)
at com.intellij.codeInspection.ex.InspectionToolWrapper.getGroupPath(InspectionToolWrapper.java:161)
at com.intellij.codeInspection.ex.InspectionSearchableOptionContributor.processOptions(InspectionSearchableOptionContributor.java:40)
at com.intellij.ide.ui.search.SearchableOptionPreloader.preload(SearchableOptionPreloader.java:49)
at com.intellij.openapi.application.Preloader.lambda$null$0(Preloader.java:74)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.application.Preloader.lambda$initComponent$1(Preloader.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
which is much better and looks like a separate problem with your code violating some contract.

java.lang.UnsupportedClassVersionError: org/jetbrains/kotlin/preloading/Preloader : Unsupported major.minor version 52.0 while compile kotlin

I am beginner in Kotlin. I am getting the following exception while doing following:
kotlinc sample.kt -include-runtime -d sample.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/jetbrains/kotlin/preloading/Preloader : Unsupported major.minor
version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Code
fun main(args: Array<String>){
var a : Int
a = getLength("Hello")
println("length of word is $a")
}
fun getLength(word : Any) : Int? {
if (word !is String) return null
return word.length
}
And kotlin version is Kotlin version 1.2.21-release-88 (JRE 1.7.0_79-b15)
JDK version which was used to build sample.jar is built with java version newr than one which you're using to compile kotlin file.
You have 2 ways:
Rebuild sample jar with your current version of JDK
Update JDK on your computer and try compiling again
Install an updated JDK, Go to File > Project Structure. Select the newer JDK version.
Then you'll be ready to go.