Repository navigation
Closed
Labels
Description
This one is a bit strange because I can't reproduce it with a simple sample. If you try to compile a simple empty Spring Boot app it falls over like this:
Build on Server(pid: 26395, port: 46211)
classlist: 2,385.00 ms
(cap): 654.30 ms
setup: 941.67 ms
analysis: 9,080.94 ms
error: Bytecode parsing error: java.lang.NoClassDefFoundError
Detailed message:
Error: Bytecode parsing error: java.lang.NoClassDefFoundError
Trace:
at parsing org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:166)
Call path from entry point to org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader$GroovyBeanDefinitionSource):
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:165)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:155)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:704)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:393)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:328)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137)
at com.example.demo.DemoApplication.main(DemoApplication.java:24)
at com.oracle.svm.reflect.proxies.Proxy_84_DemoApplication_main.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:173)
at com.oracle.svm.core.code.CEntryPointCallStubs.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Original exception that caused the problem: java.lang.NoClassDefFoundError
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.lookupType(HotSpotJVMCIRuntime.java:387)
at jdk.vm.ci.hotspot.HotSpotUnresolvedJavaType.resolve(HotSpotUnresolvedJavaType.java:91)
at com.oracle.graal.pointsto.infrastructure.WrappedSignature.getReturnType(WrappedSignature.java:55)
at com.oracle.graal.pointsto.flow.MethodFlowsGraph.<init>(MethodFlowsGraph.java:113)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.<init>(MethodTypeFlow.java:75)
at com.oracle.graal.pointsto.meta.AnalysisMethod.<init>(AnalysisMethod.java:127)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.createMethod(AnalysisUniverse.java:399)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:387)
at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupMethod(WrappedConstantPool.java:78)
at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3900)
at org.graalvm.compiler.java.BytecodeParser.genInvokeInterface(BytecodeParser.java:1454)
at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4813)
at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3114)
at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2923)
at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:888)
at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:782)
at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:95)
at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:197)
at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:196)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:315)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
at com.oracle.graal.pointsto.flow.SpecialInvokeTypeFlow.onObservedUpdate(InvokeTypeFlow.java:421)
at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:347)
at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:389)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:500)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:174)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.ClassNotFoundException: groovy.lang.Closure
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at jdk.vm.ci.hotspot.CompilerToVM.lookupType(Native Method)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.lookupType(HotSpotJVMCIRuntime.java:379)
... 35 more
Error: Processing image build request failed
The missing class is not actually needed at runtime, but we can't compile so we never get to prove it. The offending code in Spring Boot is here I think. Notice that the interface that depends on groovy.lang.Closure is never used if isGroovyPresent() is false.
I tried to reproduce the problem with a simpler program and couldn't, so I'm out of ideas now. Maybe someone else can spot the different between the above code and this (which compiles and runs):
public class Missings {
public static void main(String[] args) {
new Missings().run(args);
}
private void run(String[] args) {
Class<?> source = args.length > 0 ? ClassUtils.resolveClassName(args[0], null)
: this.getClass();
System.err.println(source + " " + isGroovyPresent());
if (isGroovyPresent()
&& GroovyBeanDefinitionSource.class.isAssignableFrom(source)) {
GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source,
GroovyBeanDefinitionSource.class);
load(loader);
throw new IllegalStateException(
"Not expecting to find GroovyBeanDefinitionSource");
}
}
private void load(GroovyBeanDefinitionSource loader) {
System.err.println(loader);
}
private boolean isGroovyPresent() {
return ClassUtils.isPresent("groovy.lang.MetaClass", null);
}
@FunctionalInterface
protected interface GroovyBeanDefinitionSource {
Closure<?> getBeans();
}
}
Activity
cstancu commentedon Jul 5, 2018
@dsyer cannot spot the difference but looking at the stack trace I can see that
BytecodeParser.genInvokeInterfaceshould be intercepted and the type resolution error should be pushed at runtime when--report-unsupported-elements-at-runtimeis used. The type resolution error seems to happen whenWrappedSignature.getReturnType()is called for the target method of an invoke interface.mageddo commentedon Jan 25, 2019
Got same issue trying to build this spring boot app
cstancu commentedon Jan 28, 2019
@mageddo your trace is different from the originally reported issue, but I think it was the same underlying problem. This issue was fixed recently (specifically in dd0bae3). The fix will be available in 1.0.0-rc12 coming out next week. In the meantime you can build from master.
@dsyer the original issue should be fixed too.
cstancu commentedon Feb 4, 2019
I will close this. Please reopen if it still occurs.