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

@Controller annotated class causes "Class proxy missing at runtime, hint required at build time" #1003

Closed
Brutus5000 opened this issue Aug 26, 2021 · 0 comments
Assignees
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@Brutus5000
Copy link

I'm trying to build a native image from a fairly small app using Webflux and R2DBC.

When launching the native image it trips over Class proxy missing at runtime, hint required at build time for OAuthController class. As the name indicates it's annotated with org.springframework.stereotype.Controller so from my understanding of the docs it should work out of the box without any hints.

Status: Downloaded newer image for faforever/faf-user-service:graalvm                                                                                                                                                                                                                                              
Starting faf-init-volumes ... done                                                                                                                                                                                                                                                                                 
Recreating faf-user-service ... done                                                                                                                                                                                                                                                                               
Attaching to faf-user-service                                                                                                                                                                                                                                                                                      
faf-user-service         | 2021-08-26 19:12:01.682  INFO 1 --- [           main] o.s.nativex.NativeListener               : This application is bootstrapped with code generated with Spring AOT                                                                                                                   
faf-user-service         |                                                                                                                                                                                                                                                                                         
faf-user-service         |   .   ____          _            __ _ _                                                                                                                                                                                                                                                 
faf-user-service         |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \                                                                                      
faf-user-service         | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
faf-user-service         |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )                                                                                    
faf-user-service         |   '  |____| .__|_| |_|_| |_\__, | / / / /                                                                                     
faf-user-service         |  =========|_|==============|___/=/_/_/_/                                                                                      
faf-user-service         |  :: Spring Boot ::                (v2.5.4)                                                                                                                                                                                                                                              
faf-user-service         |                                                                                                                                                                                                                                                                                         
faf-user-service         | 2021-08-26 19:12:01.717  INFO 1 --- [           main] o.s.boot.SpringApplication               : Starting application using Java 11.0.12 on 53efe79808bb with PID 1 (started by cnb in /workspace)                                                                                                                                                                                                             
faf-user-service         | 2021-08-26 19:12:01.717  INFO 1 --- [           main] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default                                                                                                                       
faf-user-service         | 2021-08-26 19:12:02.178  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.                                                                                                                          
faf-user-service         | 2021-08-26 19:12:02.187  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8 ms. Found 3 R2DBC repository interfaces.                                                                                                 
faf-user-service         | 2021-08-26 19:12:02.256  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.ReactiveMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.ReactiveMethodSecurityConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example:
 not eligible for auto-proxying)                                                                                                                         
faf-user-service         | 2021-08-26 19:12:02.396  WARN 1 --- [           main] i.m.c.i.binder.jvm.JvmGcMetrics          : GC notifications will not be available because MemoryPoolMXBeans are not provided by the JVM                                                                                                                                                                                                                  
faf-user-service         | 2021-08-26 19:12:02.455  INFO 1 --- [           main] c.f.userservice.hydra.HydraService       : Configure Hydra WebClient to accept untrusted certificates                                                                                                                             
faf-user-service         | 2021-08-26 19:12:02.634  INFO 1 --- [           main] o.s.aop.framework.BuildTimeAopProxy      : Unable to proxy method [private final reactor.core.publisher.Mono com.faforever.userservice.controller.OAuthController.redirect(org.springframework.http.server.reactive.ServerHttpResponse,java.lang.String)] because it is final: All calls to this method via a proxy will NOT be routed to the target inst
ance.                                                                                                                                                    
faf-user-service         | 2021-08-26 19:12:02.634  INFO 1 --- [           main] o.s.aop.framework.BuildTimeAopProxy      : Attempting discovery (load) of build time generated proxy for class: com.faforever.userservice.controller.OAuthController                                                              
faf-user-service         | 2021-08-26 19:12:02.635  INFO 1 --- [           main] o.s.aop.framework.BuildTimeAopProxy      : No suitable proxy found with name com.faforever.userservice.controller.OAuthController$$SpringProxy$3a6f79c                                                                            
faf-user-service         | 2021-08-26 19:12:02.635  WARN 1 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'OAuthController' defined in class path resource [com/faforever/userservice/controller/OAuthController.class]: Initialization of bean
 failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected problem loading and instantiating proxy for target class class com.faforever.userservice.controller.OAuthController; nested exception is java.lang.IllegalStateException: Class proxy missing at runtime, hint required at build time: @AotProxyHint(targetClass=com.faforever.userservice.controller.OAuthController.class, proxyFeatures =
 ProxyBits.IS_STATIC)                                                                                                                                                                                                                                                                                              
faf-user-service         | 2021-08-26 19:12:04.653  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :                                                                                                                                                                                                                                                                                                               
faf-user-service         |                                                                                                                                                                                                                                                                                         
faf-user-service         | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.                                                                                                                                                                                                                                                                                              
faf-user-service         | 2021-08-26 19:12:04.659 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed                                                                                                                                                                 
faf-user-service         |                                                                                                                                                                                                                                                                                                                                                                                                                
faf-user-service         | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'OAuthController' defined in class path resource [com/faforever/userservice/controller/OAuthController.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected problem loading and instantiating proxy for target class class com.faforever.userserv
ice.controller.OAuthController; nested exception is java.lang.IllegalStateException: Class proxy missing at runtime, hint required at build time: @AotProxyHint(targetClass=com.faforever.userservice.controller.OAuthController.class, proxyFeatures = ProxyBits.IS_STATIC)                                                                                                                                                              
faf-user-service         |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:610) ~[na:na]                                                                   
faf-user-service         |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[na:na]                                                                                                                                                                                                                                                          
faf-user-service         |      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na]                                                                                                                                                                                                                                                                                
faf-user-service         |      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na]                                                                                                                                             
faf-user-service         |      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na]                                                                                                                                                                  
faf-user-service         |      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na]                                                                                                                                                                    
faf-user-service         |      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[na:na]                                                                                                                                                                                                                                                            
faf-user-service         |      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[na:na]                                                                                                                                    
faf-user-service         |      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na]  
faf-user-service         |      at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[na:na]                                                                                                                                                                                                                                                        
faf-user-service         |      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[com.faforever.userservice.UserServiceApplicationKt:2.5.4]                                                                                                                                                                                                                                                             
faf-user-service         |      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[com.faforever.userservice.UserServiceApplicationKt:2.5.4]                                                                                                                               
faf-user-service         |      at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[com.faforever.userservice.UserServiceApplicationKt:2.5.4]                                                                                                                                                                                                                                                                 
faf-user-service         |      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[com.faforever.userservice.UserServiceApplicationKt:2.5.4]                                                                                                                                                                                                                                                                
faf-user-service         |      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[com.faforever.userservice.UserServiceApplicationKt:2.5.4]                                                                                                                                                                                                                                                                
faf-user-service         |      at com.faforever.userservice.UserServiceApplicationKt.main(UserServiceApplication.kt:18) ~[na:na]                                                                                    
faf-user-service         |      at com.faforever.userservice.UserServiceApplicationKt.main(UserServiceApplication.kt) ~[na:na]                                                                                       
faf-user-service         | Caused by: org.springframework.aop.framework.AopConfigException: Unexpected problem loading and instantiating proxy for target class class com.faforever.userservice.controller.OAuthController; nested exception is java.lang.IllegalStateException: Class proxy missing at runtime, hint required at build time: @AotProxyHint(targetClass=com.faforever.userservice.controller.OAuthController.class, proxyF
eatures = ProxyBits.IS_STATIC)                                                                                                                                                                                                                                                                                                                                                                                                            
faf-user-service         |      at org.springframework.aop.framework.BuildTimeAopProxy.getProxy(BuildTimeAopProxy.java:159) ~[na:na]                                                                                 
faf-user-service         |      at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[na:na]                                                                                                                                                                                                                                                                                                                
faf-user-service         |      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:478) ~[com.faforever.userservice.UserServiceApplicationKt:5.3.9]                                                                                                                                                                                                                        
faf-user-service         |      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:342) ~[com.faforever.userservice.UserServiceApplicationKt:5.3.9]                                                                                                                                                                                                                    
faf-user-service         |      at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:291) ~[com.faforever.userservice.UserServiceApplicationKt:5.3.9]                                                                                                                                                                                                     
faf-user-service         |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437) ~[na:na]                                                                                                                                                                                                                          
faf-user-service         |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[na:na]                                                                                                                                                                                                                                                     
faf-user-service         |      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[na:na]                                                                                                                                                                                                                                                        
faf-user-service         |      ... 16 common frames omitted                                                                                                                                                         
faf-user-service         | Caused by: java.lang.IllegalStateException: Class proxy missing at runtime, hint required at build time: @AotProxyHint(targetClass=com.faforever.userservice.controller.OAuthController.class, proxyFeatures = ProxyBits.IS_STATIC)                                                                                                                                                                            
faf-user-service         |      at org.springframework.aop.framework.BuildTimeAopProxy.getProxy(BuildTimeAopProxy.java:147) ~[na:na]                                                                                 
faf-user-service         |      ... 23 common frames omitted                                                                                                                                                         
faf-user-service         | 

How to reproduce:
The source code is available under https://github.com/FAForever/faf-user-service/tree/feature/graalvm
The docker image is available in the official docker hub under FAForever/faf-user-service:graalvm
A sample environment can be found here: https://github.com/FAForever/faf-stack/blob/develop/config.template/faf-user-service/faf-user-service.env

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 26, 2021
@sdeleuze sdeleuze added this to the Backlog milestone Sep 10, 2021
@sdeleuze sdeleuze added theme: aot type: compatibility Native image compatibility issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 10, 2021
@sdeleuze sdeleuze modified the milestones: Backlog, 0.11.x Oct 7, 2021
@snicoll snicoll modified the milestones: 0.11.x, 0.11.0-M2 Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

No branches or pull requests

5 participants