spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support
https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
Apache License 2.0
2.74k stars 355 forks source link

Native reflection configuration for org.springframework.ws.soap.saaj.SaajSoapMessageFactory is missing. #1696

Closed brianmolinaspring closed 2 years ago

brianmolinaspring commented 2 years ago

hello guys, how are you? I managed to compile my native image but when starting my container I get the following error:

Native reflection configuration for org.springframework.ws.soap.saaj.SaajSoapMessageFactory is missing.

022-08-21 00:27:37.907 INFO 1 --- [ main] c.c.m.MsConCbsQueryAdjustLogApplication : Starting MsConCbsQueryAdjustLogApplication using Java 11.0.15 on 308fcc294147 with PID 1 (/workspace/com.cbs.ms.MsConCbsQueryAdjustLogApplication started by cnb in /workspace) 2022-08-21 00:27:37.907 INFO 1 --- [ main] c.c.m.MsConCbsQueryAdjustLogApplication : No active profile set, falling back to 1 default profile: "default" 2022-08-21 00:27:37.916 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2022-08-21 00:27:37.918 INFO 1 --- [ main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0] 2022-08-21 00:27:37.937 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2022-08-21 00:27:37.938 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-08-21 00:27:37.938 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65] 2022-08-21 00:27:37.946 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2022-08-21 00:27:37.946 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 38 ms 2022-08-21 00:27:37.960 WARN 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queryAdjustLogClient': Unsatisfied dependency expressed through field 'ws'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queryAdjust': Unexpected exception during bean creation; nested exception is org.springframework.beans.factory.BeanInitializationException: Could not find default strategy class for interface [org.springframework.ws.WebServiceMessageFactory]; nested exception is java.lang.ClassNotFoundException: org.springframework.ws.soap.saaj.SaajSoapMessageFactory 2022-08-21 00:27:37.961 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2022-08-21 00:27:37.963 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Native reflection configuration for org.springframework.ws.soap.saaj.SaajSoapMessageFactory is missing.

Action:

Native configuration for a class accessed reflectively is likely missing. You can try to configure native hints in order to specify it explicitly. See https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#native-hints for more details.

helpme ?

sdeleuze commented 2 years ago

Hi, please follow what is suggested in the error message by adding a @TypeHint(types = org.springframework.ws.soap.saaj.SaajSoapMessageFactory.class) hint to your application.

brianmolinaspring commented 2 years ago

Thanks, but now obtain the following error:

2022-08-22 20:32:34.026 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= and -H:DynamicProxyConfigurationResources=<comma -separated-config-resources> options. 2022-08-22 20:32:34.026 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2022-08-22 20:32:34.028 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= and -H:DynamicProxyConfigurationResources= 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= 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.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

brianmolinaspring commented 2 years ago

@sdeleuze , could helpme?

brianmolinaspring commented 2 years ago

@sdeleuze @mhalbritter spring boot native has support for Jaxb2Marshaller ?

obtain this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshallerQueryAdjust': Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBExceptio n: "com.cbs.ws" doesnt contain ObjectFactory.class or jaxb.index

mhalbritter commented 2 years ago

UnsupportedFeatureError: Proxy class defined by interfaces [interface java.util.List, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found

See #1700.

mhalbritter commented 2 years ago

Regaring JAXB: It looks like the petclinic-keyvalue sample uses JAXB:

    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
    </dependency>

Please take a look at how XML support is configured there. Apart from that, we can't help you if you can't share a sample application. It doesn't have to be your private code, it can be another minimal project which demonstrates the issue you're having.

spring-projects-issues commented 2 years ago

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 commented 2 years ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.