Describe the bug
Using OpenTelemetrySdk.builder().build() throws an exception if called from a groovy class.
Steps to reproduce
Project with two dependencies
implementation("io.opentelemetry:opentelemetry-sdk:1.59.0")
implementation("org.apache.groovy:groovy:4.0.25")
Main function in a groovy class
class Test {
static void main(String[] args) {
OpenTelemetrySdk.builder().build();
}
}
What did you expect to see?
No exception
What did you see instead?
Exception in thread "main" java.lang.NoClassDefFoundError: io/opentelemetry/api/incubator/config/ConfigProvider
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
at org.codehaus.groovy.reflection.ReflectionUtils.doGetMethods(ReflectionUtils.java:153)
at org.codehaus.groovy.reflection.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:143)
at groovy.lang.MetaClassImpl.findMethod(MetaClassImpl.java:1170)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1132)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at test.Test.main(Bloop.groovy:8)
Caused by: java.lang.ClassNotFoundException: io.opentelemetry.api.incubator.config.ConfigProvider
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
Caused by: java.lang.ClassNotFoundException: io.opentelemetry.api.incubator.config.ConfigProvider
What version and what artifacts are you using?
Artifacts: opentelemetry-sdk
Version: 1.59.0 +
How did you reference these artifacts?
implementation("io.opentelemetry:opentelemetry-sdk:1.59.0")
Environment
Compiler: Javac
OS: Linux
Runtime: Corretto 17
Additional context
Using groovy 5 still errors, but a different error (groovy.lang.MissingMethodException)
Appears to be caused by #7991.
Even though the return of build() here doesn't go down the IncubatingUtil.createExtendedOpenTelemetrySdk code branch groovy appears to try to link the IncubatingUtil class and since the incubator classes are not on the class path it fails.
Describe the bug
Using
OpenTelemetrySdk.builder().build()throws an exception if called from a groovy class.Steps to reproduce
Project with two dependencies
Main function in a groovy class
What did you expect to see?
No exception
What did you see instead?
What version and what artifacts are you using?
Artifacts:
opentelemetry-sdkVersion: 1.59.0 +
How did you reference these artifacts?
Environment
Compiler: Javac
OS: Linux
Runtime: Corretto 17
Additional context
Using groovy 5 still errors, but a different error (
groovy.lang.MissingMethodException)Appears to be caused by #7991.
Even though the return of
build()here doesn't go down theIncubatingUtil.createExtendedOpenTelemetrySdkcode branch groovy appears to try to link theIncubatingUtilclass and since the incubator classes are not on the class path it fails.