Unable to instantiate VaultConfigDataLoader - spring-boot

I'm trying to configure Spring Cloud Vault in my Spring Boot application (v. 2.4.2). I'm using Spring Cloud v. 2020.0.5 (which, according to the Release train, should be fine).
C:\Tools\jdk1.8.0_92\bin\java.exe -Dspring.profiles.active=DEV,local -javaagent:C:\Apps\IC\idealC-2021.1.2\lib\idea_rt.jar=52879:C:\Apps\IC\idealC-2021.1.2\bin -Dfile.encoding=UTF-8 -classpath C:\Tools\jdk1.8.0_92\jre\lib\charsets.jar;C:\Tools\jdk1.8.0_92\jre\lib\deploy.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\access-bridge-64.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\cldrdata.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\dnsns.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\jaccess.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\jfxrt.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\localedata.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\nashorn.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\sunec.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\sunjce_provider.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\sunmscapi.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\sunpkcs11.jar;C:\Tools\jdk1.8.0_92\jre\lib\ext\zipfs.jar;C:\Tools\jdk1.8.0_92\jre\lib\javaws.jar;C:\Tools\jdk1.8.0_92\jre\lib\jce.jar;C:\Tools\jdk1.8.0_92\jre\lib\jfr.jar;C:\Tools\jdk1.8.0_92\jre\lib\jfxswt.jar;C:\Tools\jdk1.8.0_92\jre\lib\jsse.jar;C:\Tools\jdk1.8.0_92\jre\lib\management-agent.jar;C:\Tools\jdk1.8.0_92\jre\lib\plugin.jar;C:\Tools\jdk1.8.0_92\jre\lib\resources.jar;C:\Tools\jdk1.8.0_92\jre\lib\rt.jar;C:\repositories\org\apache\cxf\cxf-spring-boot-starter-jaxws\3.4.5\cxf-spring-boot-starter-jaxws-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-spring-boot-autoconfigure\3.4.5\cxf-spring-boot-autoconfigure-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-transports-http\3.4.5\cxf-rt-transports-http-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-core\3.4.5\cxf-core-3.4.5.jar;C:\repositories\com\fasterxml\woodstox\woodstox-core\6.2.6\woodstox-core-6.2.6.jar;C:\repositories\org\codehaus\woodstox\stax2-api\4.2.1\stax2-api-4.2.1.jar;C:\repositories\org\apache\ws\xmlschema\xmlschema-core\2.2.5\xmlschema-core-2.2.5.jar;C:\repositories\org\apache\cxf\cxf-rt-frontend-jaxws\3.4.5\cxf-rt-frontend-jaxws-3.4.5.jar;C:\repositories\xml-resolver\xml-resolver\1.2\xml-resolver-1.2.jar;C:\repositories\org\ow2\asm\asm\9.2\asm-9.2.jar;C:\repositories\org\apache\cxf\cxf-rt-bindings-soap\3.4.5\cxf-rt-bindings-soap-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-wsdl\3.4.5\cxf-rt-wsdl-3.4.5.jar;C:\repositories\wsdl4j\wsdl4j\1.6.3\wsdl4j-1.6.3.jar;C:\repositories\org\apache\cxf\cxf-rt-databinding-jaxb\3.4.5\cxf-rt-databinding-jaxb-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-bindings-xml\3.4.5\cxf-rt-bindings-xml-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-frontend-simple\3.4.5\cxf-rt-frontend-simple-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-ws-addr\3.4.5\cxf-rt-ws-addr-3.4.5.jar;C:\repositories\org\apache\cxf\cxf-rt-ws-policy\3.4.5\cxf-rt-ws-policy-3.4.5.jar;C:\repositories\org\apache\neethi\neethi\3.1.1\neethi-3.1.1.jar;C:\repositories\org\apache\cxf\cxf-rt-features-metrics\3.4.5\cxf-rt-features-metrics-3.4.5.jar;C:\repositories\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;C:\repositories\org\springframework\boot\spring-boot-starter\2.4.2\spring-boot-starter-2.4.2.jar;C:\repositories\org\springframework\boot\spring-boot-starter-logging\2.4.2\spring-boot-starter-logging-2.4.2.jar;C:\repositories\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\repositories\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\repositories\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;C:\repositories\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;C:\repositories\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;C:\repositories\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\repositories\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;C:\repositories\org\apache\commons\commons-lang3\3.0\commons-lang3-3.0.jar;C:\repositories\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar;C:\repositories\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\repositories\javax\activation\activation\1.1\activation-1.1.jar;C:\repositories\com\sun\xml\bind\jaxb-impl\2.1.13\jaxb-impl-2.1.13.jar;C:\repositories\org\springframework\security\spring-security-core\5.4.2\spring-security-core-5.4.2.jar;C:\repositories\org\springframework\spring-aop\5.3.3\spring-aop-5.3.3.jar;C:\repositories\org\springframework\spring-expression\5.3.3\spring-expression-5.3.3.jar;C:\repositories\org\springframework\spring-context\5.3.3\spring-context-5.3.3.jar;C:\repositories\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;C:\repositories\org\springframework\spring-web\5.3.3\spring-web-5.3.3.jar;C:\repositories\org\springframework\security\spring-security-config\5.4.2\spring-security-config-5.4.2.jar;C:\repositories\org\springframework\security\spring-security-web\5.4.2\spring-security-web-5.4.2.jar;C:\repositories\org\springframework\boot\spring-boot-starter-web\2.4.2\spring-boot-starter-web-2.4.2.jar;C:\repositories\org\springframework\boot\spring-boot-starter-json\2.4.2\spring-boot-starter-json-2.4.2.jar;C:\repositories\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;C:\repositories\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;C:\repositories\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;C:\repositories\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;C:\repositories\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;C:\repositories\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;C:\repositories\org\springframework\boot\spring-boot-starter-tomcat\2.4.2\spring-boot-starter-tomcat-2.4.2.jar;C:\repositories\org\apache\tomcat\embed\tomcat-embed-core\9.0.41\tomcat-embed-core-9.0.41.jar;C:\repositories\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.41\tomcat-embed-websocket-9.0.41.jar;C:\repositories\org\springframework\spring-webmvc\5.3.3\spring-webmvc-5.3.3.jar;C:\repositories\org\springframework\boot\spring-boot-starter-validation\2.4.2\spring-boot-starter-validation-2.4.2.jar;C:\repositories\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;C:\repositories\org\hibernate\validator\hibernate-validator\6.1.7.Final\hibernate-validator-6.1.7.Final.jar;C:\repositories\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;C:\repositories\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\repositories\org\springframework\boot\spring-boot-starter-data-jpa\2.4.2\spring-boot-starter-data-jpa-2.4.2.jar;C:\repositories\org\springframework\boot\spring-boot-starter-aop\2.4.2\spring-boot-starter-aop-2.4.2.jar;C:\repositories\org\aspectj\aspectjweaver\1.9.6\aspectjweaver-1.9.6.jar;C:\repositories\org\springframework\boot\spring-boot-starter-jdbc\2.4.2\spring-boot-starter-jdbc-2.4.2.jar;C:\repositories\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;C:\repositories\org\springframework\spring-jdbc\5.3.3\spring-jdbc-5.3.3.jar;C:\repositories\jakarta\transaction\jakarta.transaction-api\1.3.3\jakarta.transaction-api-1.3.3.jar;C:\repositories\jakarta\persistence\jakarta.persistence-api\2.2.3\jakarta.persistence-api-2.2.3.jar;C:\repositories\org\hibernate\hibernate-core\5.4.27.Final\hibernate-core-5.4.27.Final.jar;C:\repositories\org\javassist\javassist\3.27.0-GA\javassist-3.27.0-GA.jar;C:\repositories\net\bytebuddy\byte-buddy\1.10.19\byte-buddy-1.10.19.jar;C:\repositories\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\repositories\org\jboss\jandex\2.1.3.Final\jandex-2.1.3.Final.jar;C:\repositories\org\dom4j\dom4j\2.1.3\dom4j-2.1.3.jar;C:\repositories\org\hibernate\common\hibernate-commons-annotations\5.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;C:\repositories\org\glassfish\jaxb\jaxb-runtime\2.3.3\jaxb-runtime-2.3.3.jar;C:\repositories\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;C:\repositories\org\glassfish\jaxb\txw2\2.3.3\txw2-2.3.3.jar;C:\repositories\com\sun\istack\istack-commons-runtime\3.0.11\istack-commons-runtime-3.0.11.jar;C:\repositories\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\repositories\org\springframework\data\spring-data-jpa\2.4.3\spring-data-jpa-2.4.3.jar;C:\repositories\org\springframework\data\spring-data-commons\2.4.3\spring-data-commons-2.4.3.jar;C:\repositories\org\springframework\spring-orm\5.3.3\spring-orm-5.3.3.jar;C:\repositories\org\springframework\spring-tx\5.3.3\spring-tx-5.3.3.jar;C:\repositories\org\springframework\spring-aspects\5.3.3\spring-aspects-5.3.3.jar;C:\repositories\org\springframework\cloud\spring-cloud-starter-vault-config\3.0.5\spring-cloud-starter-vault-config-3.0.5.jar;C:\repositories\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\repositories\org\apache\httpcomponents\httpcore\4.4.14\httpcore-4.4.14.jar;C:\repositories\org\springframework\cloud\spring-cloud-starter\3.0.5\spring-cloud-starter-3.0.5.jar;C:\repositories\org\springframework\cloud\spring-cloud-context\3.0.5\spring-cloud-context-3.0.5.jar;C:\repositories\org\springframework\security\spring-security-crypto\5.4.2\spring-security-crypto-5.4.2.jar;C:\repositories\org\springframework\cloud\spring-cloud-commons\3.0.5\spring-cloud-commons-3.0.5.jar;C:\repositories\org\springframework\security\spring-security-rsa\1.0.10.RELEASE\spring-security-rsa-1.0.10.RELEASE.jar;C:\repositories\org\springframework\cloud\spring-cloud-vault-config\3.0.5\spring-cloud-vault-config-3.0.5.jar;C:\repositories\org\springframework\vault\spring-vault-core\2.3.2\spring-vault-core-2.3.2.jar;C:\repositories\com\ibm\mq\mq-jms-spring-boot-starter\2.4.2\mq-jms-spring-boot-starter-2.4.2.jar;C:\repositories\com\ibm\mq\com.ibm.mq.allclient\9.2.1.0\com.ibm.mq.allclient-9.2.1.0.jar;C:\repositories\org\bouncycastle\bcprov-jdk15on\1.66\bcprov-jdk15on-1.66.jar;C:\repositories\org\bouncycastle\bcpkix-jdk15on\1.66\bcpkix-jdk15on-1.66.jar;C:\repositories\javax\jms\javax.jms-api\2.0.1\javax.jms-api-2.0.1.jar;C:\repositories\org\json\json\20080701\json-20080701.jar;C:\repositories\org\springframework\spring-core\5.3.3\spring-core-5.3.3.jar;C:\repositories\org\springframework\spring-jcl\5.3.3\spring-jcl-5.3.3.jar;C:\repositories\org\springframework\spring-beans\5.3.3\spring-beans-5.3.3.jar;C:\repositories\org\springframework\spring-jms\5.3.3\spring-jms-5.3.3.jar;C:\repositories\org\springframework\spring-messaging\5.3.3\spring-messaging-5.3.3.jar;C:\repositories\org\messaginghub\pooled-jms\1.2.1\pooled-jms-1.2.1.jar;C:\repositories\org\apache\geronimo\specs\geronimo-jms_2.0_spec\1.0-alpha-2\geronimo-jms_2.0_spec-1.0-alpha-2.jar;C:\repositories\org\apache\commons\commons-pool2\2.9.0\commons-pool2-2.9.0.jar;C:\repositories\org\springframework\boot\spring-boot\2.4.2\spring-boot-2.4.2.jar;C:\repositories\org\springframework\boot\spring-boot-autoconfigure\2.4.2\spring-boot-autoconfigure-2.4.2.jar;C:\repositories\net\sf\dozer\dozer\5.5.1\dozer-5.5.1.jar;C:\repositories\commons-beanutils\commons-beanutils\1.8.0\commons-beanutils-1.8.0.jar;C:\repositories\org\slf4j\jcl-over-slf4j\1.7.30\jcl-over-slf4j-1.7.30.jar;C:\repositories\commons-io\commons-io\1.3.2\commons-io-1.3.2.jar;C:\repositories\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar;C:\repositories\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;C:\repositories\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\repositories\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\repositories\stax\stax\1.2.0\stax-1.2.0.jar;C:\repositories\com\ibm\mq\mqjms\7.0.1.7\mqjms-7.0.1.7.jar;C:\repositories\com\ibm\mq\dhbcore\7.0.1.7\dhbcore-7.0.1.7.jar;C:\repositories\com\ibm\mq\jmqi\7.0.1.7\jmqi-7.0.1.7.jar;C:\repositories\com\google\guava\guava\13.0-rc2\guava-13.0-rc2.jar;C:\repositories\com\oracle\jdbc\ojdbc8\12.2.0.1.0\ojdbc8-12.2.0.1.0.jar;C:\repositories\com\oracle\jdbc\ucp\12.2.0.1\ucp-12.2.0.1.jar;C:\repositories\net\sf\ehcache\ehcache-core\2.3.1\ehcache-core-2.3.1.jar com.example.ExampleServApplication
17:00:24.235 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: Unable to instantiate org.springframework.boot.context.config.ConfigDataLoader [org.springframework.cloud.vault.config.VaultConfigDataLoader]
at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:103)
at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:90)
at org.springframework.boot.context.config.ConfigDataLoaders.<init>(ConfigDataLoaders.java:75)
at org.springframework.boot.context.config.ConfigDataLoaders.<init>(ConfigDataLoaders.java:56)
at org.springframework.boot.context.config.ConfigDataEnvironment.<init>(ConfigDataEnvironment.java:155)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.getConfigDataEnvironment(ConfigDataEnvironmentPostProcessor.java:108)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
at com.example.ExampleServApplication.main(ExampleServApplication.java:29)
Caused by: java.lang.IllegalAccessException: Unable to find suitable constructor
at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:118)
at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:100)
... 23 common frames omitted
Any idea what might be wrong ? Am I missing some dependencies ?

I found the problem. It seems that these particular set of versions is incompatible (even though the release train says otherwise):
spring-boot 2.4.2
spring-cloud 2020.0.5
The problem is that the class ConfigDataLoaders supports DeferredLogFactory injection only in spring-boot 2.4.3:
https://github.com/spring-projects/spring-boot/commit/1def245a2cb7f5aa520531059956c3c3794625d7
On the other hand, starting with Spring Cloud 3.0.2, VaultConfigDataLoader has a new constructor accepting a DeferredLogFactory:
https://github.com/spring-cloud/spring-cloud-vault/commit/a9fd88c3b768a1f6e485851423dd8f62afae71ba
So, either use Spring Boot 2.4.2 and Spring Cloud 3.0.1 (or lower) or use Spring Boot 2.4.3 and Spring Cloud 3.0.2+.
I hope this investigation will save somebody some time, as it took me about half a day..

Related

GraalVM Native Image Manual Proxy Configuration

We migrated an appication to GraalVM docker image, Building a Native Image Using Buildpacks. The application previously running on JDK 8 and Spring boot 2.2.0.RELEASE. We migrated to JDK-17 and SpringBoot 3.0.2 as GraalVM latest prerequisite. The image has been build successfully, but while trying to run the container we are the below error
2023-02-17 11:18:10,233 ERROR [main] o.s.b.SpringApplication: Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exposeAttemptedPathAuthenticationAuditListener': Instantiation of supplied bean failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1236)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
at com.abc.cefg.iom.App.main(Application.java:7)
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface jakarta.servlet.http.HttpServletRequest] not found. Generating 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)
at com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:171)
at java.base#17.0.6/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47)
at java.base#17.0.6/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037)
at org.springframework.beans.factory.support.AutowireUtils.resolveAutowiringValue(AutowireUtils.java:134)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1576)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1368)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225)
... 18 common frames omitted
As new to graalvm native images, don't know whether need to configure the proxies in config files or something to tell AOT compiler to take into consideration
Need to run the graalvm docker continer succssfully

Spring Boot 3 and JSP application won't run as standalone

I upgraded a JSP application to Spring Boot 3 and now it won't start when running as a standalone application.
If I start the application using gradle bootRun it runs fine.
When runing it using java -jar oldnewjspapp.war I get the following stacktrace:
ERROR 7082 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.0.1.jar!/:3.0.1]
...
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-3.0.1.jar!/:3.0.1]
...
Caused by: java.lang.IllegalStateException: zip file closed
at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:831) ~[na:na]
at java.base/java.util.zip.ZipFile.getManifestName(ZipFile.java:1057) ~[na:na]
at java.base/java.util.zip.ZipFile$1.getManifestName(ZipFile.java:1100) ~[na:na]
at java.base/java.util.jar.JarFile.getManEntry(JarFile.java:937) ~[na:na]
at java.base/java.util.jar.JarFile.checkForSpecialAttributes(JarFile.java:1000) ~[na:na]
at java.base/java.util.jar.JarFile.isMultiRelease(JarFile.java:389) ~[na:na]
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:68) ~[tomcat-embed-core-10.1.4.jar!/:na]
Does anyone have a solution?
Spring Boot 3 JSP support is broken:
Spring boot app's .jar not working (issue with tomcat-embed-jasper)
https://github.com/spring-projects/spring-boot/issues/33633
https://github.com/spring-projects/spring-boot/issues/32106
The alternatives are:
downgrade your Spring Boot version
extract the war contents and run it that way
generate a regular war (gradle war) and publish it in your favourite web server
turn off the support for Multi-Release JAR Files (this feature is present in Java since release 9): java -Djdk.util.jar.enableMultiRelease=false -jar oldnewjspapp.war

Missing required configuration "schema.registry.url" with spring-kafka 2.8.x

With org.springframework.kafka:spring-kafka up to version 2.7.9, my Spring-Boot application (consuming/producing Avro from/to Kafka) starts fine, having these environment variables set:
- name: SPRING_KAFKA_CONSUMER_PROPERTIES_SCHEMA_REGISTRY_URL
value: "http://avro-schema-registry.core-kafka.svc.cluster.local:8081"
- name: SPRING_KAFKA_PRODUCER_PROPERTIES_SCHEMA_REGISTRY_URL
value: "http://avro-schema-registry.core-kafka.svc.cluster.local:8081"
But with version 2.8.2 (same with 2.8.1 and 2.8.0), I get the following error:
org.apache.kafka.common.config.ConfigException: Missing required configuration "schema.registry.url" which has no default value.
Full error from the logs:
2022-01-18 07:15:10,162 [main] ERROR SpringApplication - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.config.ConfigException: Missing required configuration "schema.registry.url" which has no default value.
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.base/java.lang.Iterable.forEach(Unknown Source)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
at com.acme.foo.bar.ApplicationKt.main(Application.kt:52)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.apache.kafka.common.config.ConfigException: Missing required configuration "schema.registry.url" which has no default value.
at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:478)
at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:468)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:108)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:129)
at io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig.<init>(AbstractKafkaSchemaSerDeConfig.java:211)
at io.confluent.kafka.serializers.KafkaAvroDeserializerConfig.<init>(KafkaAvroDeserializerConfig.java:58)
at io.confluent.kafka.serializers.KafkaAvroDeserializer.configure(KafkaAvroDeserializer.java:50)
at org.springframework.kafka.support.serializer.ErrorHandlingDeserializer.configure(ErrorHandlingDeserializer.java:139)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.lambda$keyDeserializerSupplier$5(DefaultKafkaConsumerFactory.java:142)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createRawConsumer(DefaultKafkaConsumerFactory.java:415)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createKafkaConsumer(DefaultKafkaConsumerFactory.java:384)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createConsumerWithAdjustedProperties(DefaultKafkaConsumerFactory.java:360)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createKafkaConsumer(DefaultKafkaConsumerFactory.java:327)
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createConsumer(DefaultKafkaConsumerFactory.java:304)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.<init>(KafkaMessageListenerContainer.java:758)
at org.springframework.kafka.listener.KafkaMessageListenerContainer.doStart(KafkaMessageListenerContainer.java:344)
at org.springframework.kafka.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:430)
at org.springframework.kafka.listener.ConcurrentMessageListenerContainer.doStart(ConcurrentMessageListenerContainer.java:209)
at org.springframework.kafka.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:430)
at org.springframework.kafka.config.KafkaListenerEndpointRegistry.startIfNecessary(KafkaListenerEndpointRegistry.java:331)
at org.springframework.kafka.config.KafkaListenerEndpointRegistry.start(KafkaListenerEndpointRegistry.java:276)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 22 common frames omitted
I don't see a remark about such a change in the release notes of spring-kafka. And idea what I might be doing wrong?
Ok, the trick is to simply not provide an explicit version for spring-kafka (in my case in the build.gradle.kts), but let the Spring dependency management (id("io.spring.dependency-management") version "1.0.11.RELEASE") choose the appropriate one.
2.7.7 is the version that is then currently chosen automatically (with Spring Boot version 2.5.5).
I met the same issue. And after debugging into the code, I found that there is one change in Spring Kafka 2.8
https://github.com/spring-projects/spring-kafka/commit/852c447442c9ac3a4eb41e2ddbcfc83ebe8c97da This will cause a reconfiguration of your serializer and deserializer, which won't work for avro ones.
Starting with version 2.8, if you provide serializers as objects (in the constructor or via the setters), the factory will invoke the configure() method to configure them with the configuration properties.
There is also a related discussion in Spring Kafka serialiser config
Looking at https://github.com/spring-projects/spring-kafka/issues/2274 I think this issue will be fixed by providing an extra option to disable the reconfiguration.
public DefaultKafkaConsumerFactory(Map<String, Object> configs,
#Nullable Supplier<Deserializer<K>> keyDeserializerSupplier,
#Nullable Supplier<Deserializer<V>> valueDeserializerSupplier, boolean configureDeserializers) {
this.configs = new ConcurrentHashMap<>(configs);
this.configureDeserializers = configureDeserializers;
this.keyDeserializerSupplier = keyDeserializerSupplier(keyDeserializerSupplier);
this.valueDeserializerSupplier = valueDeserializerSupplier(valueDeserializerSupplier);
}

java.lang.IllegalStateException: Unable to load config data from 'http://localhost:8888'

I am facing an issue with Spring cloud. The used versions are,
Spring boot version: 2.4.4
Spring cloud version: 2020.0.2
Your input will help me to resolve the microservice startup issue.
I have a spring cloud config server which pick the data from repository and the endpoint
http://localhost:8888/xyz-service/default returning data.
I am trying to read the configuration from microservice which fails to connect to the config server, please refer below error
13:25:09.887 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
*java.lang.IllegalStateException: Unable to load config data from 'optional:configserver:http://localhost:8888*'
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:125)
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:112)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve$1(ConfigDataLocationResolvers.java:114)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:125)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:114)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:106)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:101)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:93)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:81)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:119)
at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:230)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:217)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:88)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:80)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
at com.microservice.limitmicroservice.LimitMicroserviceApplication.main(LimitMicroserviceApplication.java:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferencesForFile(StandardConfigDataLocationResolver.java:200)
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:122)
... 35 common frames omitted
Process finished with exit code 0
I see the person did not answer, I have two different applications. They have the same config and the same POM but one gives me this error.
This is the config for both applications, both uses spring boot version 2.4.4, uses java 11, spring cloud 2020.0.2
spring.cloud.config.enabled=false
spring.jmx.enabled=true
management.endpoints.web.exposure.include=*
but the second one fails with similar the error than above
java.lang.IllegalStateException: Unable to load config data from 'optional:configserver:'
Make sure you have the following dependency in your pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
The main reason for this problem is that spring boot does not know how to read the configuration from (for example) repository on github. To solve this problem, you should check whether the following dependency exists in the corresponding module (versions can be different) :
implementation 'org.springframework.cloud:spring-cloud-starter-config:3.1.5'
Connecting this starter should solve your problem

Is apache camel compatible with Springboot 2.0?

Which version of apache-camel is compatible with Springboot 2.0?
I keep getting this error
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver
at java.net.URLClassLoader.findClass (URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass (ClassLoader.java:424)
at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
at org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator.isEnabled (HierarchicalPropertiesEvaluator.java:49)
at org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator.evaluate (HierarchicalPropertiesEvaluator.java:42)
at org.apache.camel.spring.boot.util.GroupCondition.getMatchOutcome (GroupCondition.java:40)
It is not yet compatible as it is using Spring 1.15.x. support is planned for Camel 2.22.
Migrated Spring boot 1.5 to 2.0, unable to start app getting: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver

Resources