Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Runtime Error: java.lang.NoSuchMethodException: org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$EmptyHandler.handle() #1510

Closed
salvob opened this issue Feb 24, 2022 · 17 comments
Assignees
Labels
status: blocked An issue that's blocked on an external project change or another issue type: bug A general bug

Comments

@salvob
Copy link

salvob commented Feb 24, 2022

Hi, I have runtime error when compile with arg --language:js

GraalVm version 22.0.0.2 graalvm-ce-java17-darwin-amd64

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping': Unexpected exception during bean creation; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:555) ~[na:na] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[na:na] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[na:na] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[na:na] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[api:2.6.1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[api:2.6.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[api:2.6.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[api:2.6.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[api:2.6.1] at com.epipoli.HwApplication.main(HwApplication.java:55) ~[api:0.0.1] Caused by: java.lang.ExceptionInInitializerError: null at java.lang.Class.ensureInitialized(DynamicHub.java:549) ~[api:na] at java.lang.Class.ensureInitialized(DynamicHub.java:549) ~[api:na] at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.createRequestMappingHandlerMapping(WebMvcConfigurationSupport.java:351) ~[api:5.3.13] at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.createRequestMappingHandlerMapping(WebMvcAutoConfiguration.java:543) ~[api:2.6.1] at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:311) ~[api:5.3.13] at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.requestMappingHandlerMapping(WebMvcAutoConfiguration.java:445) ~[api:2.6.1] at org.springframework.aot.ContextBootstrapInitializer.lambda$initialize$24(ContextBootstrapInitializer.java:244) ~[na:na] at org.springframework.aot.beans.factory.ThrowableFunction.apply(ThrowableFunction.java:18) ~[na:na] at org.springframework.aot.beans.factory.InjectedElementResolver.create(InjectedElementResolver.java:51) ~[na:na] at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$InstanceSupplierContext.create(BeanDefinitionRegistrar.java:193) ~[na:na] at org.springframework.aot.ContextBootstrapInitializer.lambda$initialize$25(ContextBootstrapInitializer.java:244) ~[na:na] at org.springframework.aot.beans.factory.ThrowableFunction.apply(ThrowableFunction.java:18) ~[na:na] at org.springframework.aot.beans.factory.BeanDefinitionRegistrar.lambda$instanceSupplier$0(BeanDefinitionRegistrar.java:97) ~[na:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1249) ~[na:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191) ~[na:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[na:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[na:na] ... 14 common frames omitted Caused by: java.lang.IllegalStateException: Expected method not found: java.lang.NoSuchMethodException: org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$EmptyHandler.handle() at org.springframework.util.ClassUtils.getMethod(ClassUtils.java:1141) ~[na:na] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.<clinit>(AbstractHandlerMethodMapping.java:84) ~[na:na] ... 31 common frames omitted

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 24, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Mar 3, 2022

Please share a repro project.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Mar 3, 2022
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Mar 10, 2022
@LilPoppy
Copy link

I have a same issue with OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 17.0.2+8-jvmci-22.0-b05)

2022-03-15 01:39:38.573 ERROR 39550 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping': Unexpected exception during bean creation; nested exception is java.lang.ExceptionInInitializerError
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:555) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[na:na]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[cobnet:2.6.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[cobnet:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[cobnet:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[cobnet:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[cobnet:2.6.4]
	at com.cobnet.EntryPoint.main(EntryPoint.java:77) ~[cobnet:0.0.1-SNAPSHOT]
Caused by: java.lang.ExceptionInInitializerError: null
	at java.lang.Class.ensureInitialized(DynamicHub.java:510) ~[cobnet:na]
	at java.lang.Class.ensureInitialized(DynamicHub.java:510) ~[cobnet:na]
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.createRequestMappingHandlerMapping(WebMvcConfigurationSupport.java:351) ~[cobnet:5.3.16]
	at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.createRequestMappingHandlerMapping(WebMvcAutoConfiguration.java:543) ~[cobnet:2.6.4]
	at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:311) ~[cobnet:5.3.16]
	at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.requestMappingHandlerMapping(WebMvcAutoConfiguration.java:445) ~[cobnet:2.6.4]
	at org.springframework.aot.ContextBootstrapInitializer.lambda$initialize$24(ContextBootstrapInitializer.java:399) ~[na:na]
	at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$ThrowableFunction.apply(BeanDefinitionRegistrar.java:294) ~[na:na]
	at org.springframework.aot.beans.factory.InjectedElementResolver.create(InjectedElementResolver.java:67) ~[na:na]
	at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$BeanInstanceContext.create(BeanDefinitionRegistrar.java:211) ~[na:na]
	at org.springframework.aot.ContextBootstrapInitializer.lambda$initialize$25(ContextBootstrapInitializer.java:399) ~[na:na]
	at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$ThrowableFunction.apply(BeanDefinitionRegistrar.java:294) ~[na:na]
	at org.springframework.aot.beans.factory.BeanDefinitionRegistrar.lambda$instanceSupplier$0(BeanDefinitionRegistrar.java:115) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1249) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[na:na]
	... 14 common frames omitted
Caused by: java.lang.IllegalStateException: Expected method not found: java.lang.NoSuchMethodException: org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$EmptyHandler.handle()
	at org.springframework.util.ClassUtils.getMethod(ClassUtils.java:1141) ~[na:na]
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.<clinit>(AbstractHandlerMethodMapping.java:84) ~[cobnet:5.3.16]
	... 31 common frames omitted

Seen this exception is which method not found , I have attempt to add the below into my reflect-config.json . But still it's not working.

 {
    "name":"org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.EmptyHandler",
    "methods":[{ "name":"<init>","parameterTypes":[] } , { "name": "handle", "parameterTypes": [] }],
    "queryAllDeclaredMethods": true
  }

@sdeleuze
Copy link
Contributor

@LilPoppy Could you please provide a repro project?

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-feedback We need additional information before we can continue labels Mar 15, 2022
@LilPoppy
Copy link

LilPoppy commented Mar 16, 2022

repro project?

Sure @sdeleuze , here is the repository with CI

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 16, 2022
@sdeleuze
Copy link
Contributor

Sorry the setup to reproduce is not obvious, I followed readme instructions and the build is broken due to the database. Could you please provide a more focused repro with complete instructions to reproduce?

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 18, 2022
@LilPoppy
Copy link

Sorry the setup to reproduce is not obvious, I followed readme instructions and the build is broken due to the database. Could you please provide a more focused repro with complete instructions to reproduce?

Hi @sdeleuze , You should config a bit for your environment.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 18, 2022
@LilPoppy
Copy link

LilPoppy commented Mar 18, 2022

Hi @sdeleuze , I have found out some other issues from GraalVM and have them commented.

  1. No supported Datasource type found.
  2. @EnableRedisHttpSession will cause: Cannot invoke "org.springframework.util.StringValueResolver.resolveStringValue(String)" because "this.embeddedValueResolver" is null
  3. Context.create() java.lang.NullPointerException: Cannot invoke "com.oracle.truffle.api.impl.TVMCI.createRuntimeSupport(Object)"
  4. AuthenticationManager
  5. Now you will see the case of this topic

Also, MySQL and Redis are required to be installed.

@sdeleuze
Copy link
Contributor

@LilPoppy Please update the sample and documentation to make it usable out of the box, for example by updating docker-compose.yml to run MySQL and Redis with a simple docker-compose up or by adding a script that will set the various properties.

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 21, 2022
@LilPoppy
Copy link

LilPoppy commented Mar 22, 2022

@LilPoppy Please update the sample and documentation to make it usable out of the box, for example by updating docker-compose.yml to run MySQL and Redis with a simple docker-compose up or by adding a script that will set the various properties.

Hi @sdeleuze , I have just updated the pom.xml and compose configuration. You can run mvn clean package -Pdocker to build the container. But before run the command make sure you have shutdown default port of 6379;
e.g :
sudo lsof -I :6379
kill -9 [pid]

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 22, 2022
@sdeleuze
Copy link
Contributor

I tried and got the following error that seems unrelated with the issue you raised:

[INFO] DOCKER> [91mError: The reflection configuration file "/build/src/main/java/extra-reflect-config.json" does not exist.
[INFO] DOCKER> [91mcom.oracle.svm.core.util.UserError$UserException: The reflection configuration file "/build/src/main/java/extra-reflect-config.json" does not exist.

Could you please fix it?

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 25, 2022
@LilPoppy
Copy link

I tried and got the following error that seems unrelated with the issue you raised:

[INFO] DOCKER> [91mError: The reflection configuration file "/build/src/main/java/extra-reflect-config.json" does not exist.
[INFO] DOCKER> [91mcom.oracle.svm.core.util.UserError$UserException: The reflection configuration file "/build/src/main/java/extra-reflect-config.json" does not exist.

Could you please fix it?

Hi @sdeleuze , you can add this file into the path, or remove this line instead. This is another issue from GraalVM.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 25, 2022
@sdeleuze
Copy link
Contributor

Another error --trace-class-initialization=org.springframework.session.data.redis.RedisFlushMode, I will make a last try if you fix it before closing this issue.

The error you see is not expected to happen with GraalVM 22.0 because inlining is enabled, so unless -H:-InlineBeforeAnalysis the reflective access is expected to be inlined and not requiring explicit reflection configuration.

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 28, 2022
@LilPoppy
Copy link

LilPoppy commented Mar 30, 2022

Another error --trace-class-initialization=org.springframework.session.data.redis.RedisFlushMode, I will make a last try if you fix it before closing this issue.

The error you see is not expected to happen with GraalVM 22.0 because inlining is enabled, so unless -H:-InlineBeforeAnalysis the reflective access is expected to be inlined and not requiring explicit reflection configuration.

@sdeleuze , I have configured easy way to build as docker.

Pull newest from repository first:
git clone https://github.com/SpamanDev/StoreChain-Server.git

Check if you have any Redis port opening:
sudo lsof -i :6379

Kill the redis if you have any exists:
kill -9 [pid]

Then run the following:
mvn -DskipTests -Dredis-host=redis -Ddb-host=db clean package -Pdocker

After done container run:
docker start -a cobnet

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 30, 2022
@sdeleuze sdeleuze self-assigned this Mar 31, 2022
@sdeleuze
Copy link
Contributor

Ok, I was able to reproduce after your latest comment and I can also reproduce with @NativeHint(options = "--language:js") added to the webmvc-tomcat sample. It seems --language:js also apply -H:-InlineBeforeAnalysis since this kind of error appear when inlining does not work. I will ping GraalVM team about that.

@sdeleuze sdeleuze added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Mar 31, 2022
@sdeleuze sdeleuze added this to the 0.11.4 milestone Mar 31, 2022
@LilPoppy
Copy link

Ok thank you

@sdeleuze sdeleuze removed this from the 0.11.4 milestone Apr 5, 2022
@sdeleuze sdeleuze added the status: blocked An issue that's blocked on an external project change or another issue label Apr 5, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 5, 2022

Should be fixed on GraalVM side, you can follow oracle/graal#4473.

@sdeleuze sdeleuze closed this as completed Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: blocked An issue that's blocked on an external project change or another issue type: bug A general bug
Development

No branches or pull requests

4 participants