NoClassDefFoundError for most but not all Kotlin classes in project


#1

I am getting NoClassDefFoundError at runtime for most, but not all of the classes in my project. I have tried running through Gradle with the application plugin, through Gradle by running my tests, and in a Kotlin scratch file and get the same issue. The stack trace does not link back to my code. Here is an example of the error (substituted actual class names):

Exception in thread "main" java.lang.NoClassDefFoundError: package/Class
	at org.jetbrains.kotlin.idea.scratch.generated.ScratchFileRunnerGenerated$ScratchFileRunnerGenerated.generated_get_instance_res1(tmp.kt:31)
	at org.jetbrains.kotlin.idea.scratch.generated.ScratchFileRunnerGenerated.main(tmp.kt:43)
Caused by: java.lang.ClassNotFoundException: package/Class
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 2 more

I’m not sure where to start in addressing this. The build configuration in this project is very similar to my other projects and so far me tweaking random things hasn’t given me any clues.


#2

Can you please create an issue on http://kotl.in/issue and attach your project (can be done privately) so we can try to reproduce this problem?


#3

Here it is: https://youtrack.jetbrains.com/issue/KT-25738