aclement/spring-boot-graal-feature

When run on Mac with your samples error

guanchao-yang opened this issue · 6 comments

When I run your samples using graal with commond sh compile.sh, got the errors below:

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                        

22:05:48.973 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.annotation.AnnotationConfigApplicationContext]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>()
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
        at org.springframework.boot.SpringApplication.createApplicationContext(SpringApplication.java:614)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1275)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1263)
        at com.example.demo.DemoApplication.main(DemoApplication.java:16)
Caused by: java.lang.NoSuchMethodException: org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>()
        at java.lang.Class.getConstructor0(DynamicHub.java:3082)
        at java.lang.Class.getDeclaredConstructor(DynamicHub.java:2178)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:134)
        ... 5 common frames omitted

real    0m0.017s
user    0m0.006s
sys     0m0.007s

@aclement Thank you for your help

@aclement GraalVM version graalvm-ce-19.0.0

Hitting same error here.

Unpacking demo-0.0.1-SNAPSHOT.jar

Compile
[demo:23903] classlist: 14,957.31 ms
[demo:23903] (cap): 1,967.70 ms
[demo:23903] setup: 5,317.64 ms
Warning: class initialization of class org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext failed with exception java.lang.NoClassDefFoundError: javax/servlet/ServletException. This class will be initialized at run time because either option --report-unsupported-elements-at-runtime or option --allow-incomplete-classpath is used for image building. Use the option --delay-class-initialization-to-runtime=org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext to explicitly request delayed initialization of this class.
Warning: class initialization of class org.springframework.core.io.VfsUtils failed with exception java.lang.ExceptionInInitializerError. This class will be initialized at run time because either option --report-unsupported-elements-at-runtime or option --allow-incomplete-classpath is used for image building. Use the option --delay-class-initialization-to-runtime=org.springframework.core.io.VfsUtils to explicitly request delayed initialization of this class.
[demo:23903] (typeflow): 40,016.62 ms
[demo:23903] (objects): 12,888.08 ms
[demo:23903] (features): 1,112.46 ms
[demo:23903] analysis: 54,753.50 ms
[demo:23903] universe: 1,595.48 ms
[demo:23903] (parse): 9,244.50 ms
[demo:23903] (inline): 12,791.95 ms
[demo:23903] (compile): 110,687.87 ms
[demo:23903] compile: 135,040.11 ms
[demo:23903] image: 3,039.47 ms
[demo:23903] write: 655.34 ms
[demo:23903] [total]: 215,887.00 ms

Compiled app (demo)
08:02:17.305 [main] DEBUG org.springframework.core.env.StandardEnvironment - Activating profiles []

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot ::

08:02:17.306 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.annotation.AnnotationConfigApplicationContext]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.context.annotation.AnnotationConfigApplicationContext.
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.boot.SpringApplication.createApplicationContext(SpringApplication.java:614)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1275)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1263)
at com.example.demo.DemoApplication.main(DemoApplication.java:16)
Caused by: java.lang.NoSuchMethodException: org.springframework.context.annotation.AnnotationConfigApplicationContext.
at java.lang.Class.getConstructor0(DynamicHub.java:3082)
at java.lang.Class.getDeclaredConstructor(DynamicHub.java:2178)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:134)
... 5 common frames omitted

real 0m0.004s
user 0m0.002s
sys 0m0.002s

[npark@forretire2 demo]$ uname -a
Linux forretire2 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[npark@forretire2 demo]$ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) GraalVM EE 1.0.0-rc16 (build 25.202-b08-jvmci-0.59, mixed mode)

[npark@forretire2 demo]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)

@guanchao-yang @maceopark have you tried to compile spring-boot-graal-feature-0.5.0 library first?
In the project's root execute 'mvn clean install' to first build this library, than go to the sample directory and execute compile.sh
I had your same errors that disappeared after executing this procedure.

@spiritokko Yes, i do. Like below :

export CP=$CP:$HOME/.m2/org/springframework/spring-boot-graal-feature/0.5.0.BUILD-SNAPSHOT/spring-boot-graal-feature-0.5.0.BUILD-SNAPSHOT.jar:$HOME/.m2/org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar:$HOME/.m2/org/ow2/asm/asm/7.1/asm-7.1.jar

merge master code and use graalvm-ce-19.0.0 fixed