NoClassDefFoundError on file in project code base


(shurgin) #1

I have a maven project that I am attempting to convert to Gradle.

The project has a mixture of Groovy and Java files, and is composed of 55 sub-projects.

About two thirds of the way through the sub-projects, the Groovy Compiler fails with the following stacktrace.

I have seen this error in other posts on the net, but they always refer to classes that are in jar files that should be included as dependencies. The class that this error is referring to is an interface in my code base.

What am I missing? The code compiles clean under Maven.

Caused by: java.lang.NoClassDefFoundError: Lorg/oclc/cataloging/service/record/RecordLockChecker;

at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:119)

at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:40)

at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:53)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)

at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) Caused by: java.lang.ClassNotFoundException: org.oclc.cataloging.service.record.RecordLockChecker

at org.gradle.internal.classloader.TransformingClassLoader.findClass(TransformingClassLoader.java:41)

… 7 more


(Peter Niederwieser) #2

You may be missing a compile dependency. Or perhaps you have bidirectional dependencies between Groovy and Java code in the same project, but aren’t using joint compilation.


(shurgin) #3

I have altered the paths to use joint compilation.

sourceSets.main.java.srcDirs = []
    sourceSets.main.groovy.srcDirs = ["src/main/java", "src/main/groovy"]
      sourceSets.test.java.srcDirs = []
    sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/groovy"]

Would the dependency problem be in the file mentioned, or in a file that references this file. The class in question is an interface, with 1 include. The jar file that contains the included path is in the dependency list.