Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
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

Description

@salvob

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

Activity

  1. sdeleuze commented on Mar 3, 2022

    @sdeleuze
    Contributor

    Please share a repro project.

  2. spring-projects-issues commented on Mar 10, 2022

    @spring-projects-issues

    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.

  3. LilPoppy commented on Mar 15, 2022

    @LilPoppy

    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
      }
    
  4. sdeleuze commented on Mar 15, 2022

    @sdeleuze
    Contributor

    @LilPoppy Could you please provide a repro project?

  5. added and removed
    status: feedback-reminderWe've sent a reminder that we need additional information before we can continue
    on Mar 15, 2022
  6. LilPoppy commented on Mar 16, 2022

    @LilPoppy

    repro project?

    Sure @sdeleuze , here is the repository with CI

  7. sdeleuze commented on Mar 18, 2022

    @sdeleuze
    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?

  8. 19 remaining items

  9. LilPoppy commented on Mar 30, 2022

    @LilPoppy

    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

  10. self-assigned this
    on Mar 31, 2022
  11. sdeleuze commented on Mar 31, 2022

    @sdeleuze
    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.

  12. added this to the 0.11.4 milestone on Mar 31, 2022
  13. LilPoppy commented on Mar 31, 2022

    @LilPoppy

    Ok thank you

  14. removed this from the 0.11.4 milestone on Apr 5, 2022
  15. added
    status: blockedAn issue that's blocked on an external project change or another issue
    on Apr 5, 2022
  16. sdeleuze commented on Apr 5, 2022

    @sdeleuze
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: blockedAn issue that's blocked on an external project change or another issuetype: bugA general bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions