spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support

Home Page:https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(DynamicProxyConfigurationFiles) Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement

brianmolinaspring opened this issue · comments

hello guys, could you help me?

2022-08-22 20:58:55.095  WARN 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initializati
on - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'swagger2Controll
erWebMvc': Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationExc
eption: Error creating bean with name 'webMvcSwaggerTransformationFilterRegistry': FactoryBean threw exception on object creation; nested exceptio
n is com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface java.util.List, interface org.springframework.a
op.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating pro
xy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implem
ent. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma
-separated-config-resources> options.
2022-08-22 20:58:55.095  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-08-22 20:58:55.099 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'swagger2ControllerWebMvc': Unsatisfied dependency
 expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'webMvcSwaggerTransformationFilterRegistry': FactoryBean threw exception on object creation; nested exception is com.oracle.svm.core.jdk.Unsu
pportedFeatureError: Proxy class defined by interfaces [interface java.util.List, interface org.springframework.aop.SpringProxy, interface org.spr
ingframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supp
orted. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use 
-H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> opti
ons.
        at org.springframework.aot.beans.factory.InjectedConstructionResolver.resolve(InjectedConstructionResolver.java:88) ~[na:na]
        at org.springframework.aot.beans.factory.InjectedElementResolver.resolve(InjectedElementResolver.java:35) ~[com.cbs.ms.MsConCbsQueryAdjust
LogApplication:0.12.1]
        at org.springframework.aot.beans.factory.InjectedElementResolver.create(InjectedElementResolver.java:66) ~[com.cbs.ms.MsConCbsQueryAdjustL
ogApplication:0.12.1]
        at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$BeanInstanceContext.create(BeanDefinitionRegistrar.java:211) ~[na:na]    
        at org.springframework.aot.ContextBootstrapInitializer.lambda$initialize$1(ContextBootstrapInitializer.java:350) ~[na:na]
        at org.springframework.aot.beans.factory.BeanDefinitionRegistrar$ThrowableFunction.apply(BeanDefinitionRegistrar.java:294) ~[com.cbs.ms.Ms
ConCbsQueryAdjustLogApplication:0.12.1]
        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) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java
:1191) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) 
~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[
com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[com.cbs.ms.MsConCbsQue
ryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[com.cbs.ms
.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[com.cbs.ms.MsConCbsQueryAdjustL
ogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[com.cbs.ms.MsConCbsQueryAdjustLog
Application:5.3.22]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[co
m.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[c
om.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[com.cbs.ms.MsConCbsQueryA
djustLogApplication:5.3.22]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[
na:na]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]      
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na
]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]
        at com.cbs.ms.MsConCbsQueryAdjustLogApplication.main(MsConCbsQueryAdjustLogApplication.java:92) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplica
tion:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webMvcSwaggerTransformationFilterRegistry': Fac
toryBean threw exception on object creation; nested exception is com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interface
s [interface java.util.List, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.spr
ingframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image buil
d time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-co
nfig-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:176) ~[
com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[co
m.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1884) ~[com.cbs.ms.MsCo
nCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactor
y.java:1284) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:345) ~[com.cbs.ms.MsConCbsQueryAdjustL
ogApplication:5.3.22]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[com.cbs.ms.MsConCbsQueryAdjustLog
Application:5.3.22]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[com.cbs.ms.MsConCbsQuer
yAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[com.cb
s.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[com.cbs.
ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        at org.springframework.aot.beans.factory.InjectedConstructionResolver.lambda$resolve$0(InjectedConstructionResolver.java:83) ~[na:na]     
        at org.springframework.aot.beans.factory.InjectedConstructionResolver.resolveDependency(InjectedConstructionResolver.java:97) ~[na:na]    
        at org.springframework.aot.beans.factory.InjectedConstructionResolver.resolve(InjectedConstructionResolver.java:83) ~[na:na]
        ... 24 common frames omitted
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface java.util.List, interface org.springframe
work.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generati
ng proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they 
implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=
<comma-separated-config-resources> options.
        at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na]
        at com.oracle.svm.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:158) ~[na:na]
        at java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:48) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1006) ~[com.cbs.ms.MsConCbsQueryAdjustLogApplication:na]
        at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:126) ~[na:na]
        at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:118) ~[na:na]
        at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:97) ~[na:na]
        at org.springframework.plugin.core.support.AbstractTypeAwareSupport.getBeans(AbstractTypeAwareSupport.java:94) ~[com.cbs.ms.MsConCbsQueryA
djustLogApplication:2.0.0.RELEASE]
        at org.springframework.plugin.core.support.PluginRegistryFactoryBean.getObject(PluginRegistryFactoryBean.java:38) ~[com.cbs.ms.MsConCbsQue
ryAdjustLogApplication:2.0.0.RELEASE]
        at org.springframework.plugin.core.support.PluginRegistryFactoryBean.getObject(PluginRegistryFactoryBean.java:29) ~[com.cbs.ms.MsConCbsQue
ryAdjustLogApplication:2.0.0.RELEASE]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ~[
com.cbs.ms.MsConCbsQueryAdjustLogApplication:5.3.22]
        ... 35 common frames omitted

If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

@mhalbritter , Good morning, I can't share the sources since it's not open source, do you have an alternative to help me, I don't understand what could be happening, I've been trying to compile for several days, but I keep getting this "Error creating bean with name 'webMvcSwaggerTransformationFilterRegistry" , I tried to remove everything related to swagger, but now with an error "webMvcOpenApiTransformationFilterRegistry" it's like I couldn't create the beans, any suggestions?

It complains about a proxy:

Proxy class defined by interfaces [interface java.util.List, interface org.springframe
work.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy]

You can workaround by using

@JdkProxyHint(types = {java.util.List.class ,org.springframework.aop.SpringProxy.class, org.springframework.aop.framework.Advised.class, org.springframework.core.DecoratingProxy.class})

on your @SpringBootApplication class.

this solution for me, thanks