bootstrap.yml configuration not processed anymore with Spring Cloud 2020.0 - java

In my Spring Boot project, I defined 4 profiles
demo
dev
test
prod
properties in YAML files will be replaced by HashiCorp Vault properties during startup. For this, I use Spring Cloud Vault library. Everything works as expected in Spring Boot 2.3.x
When I try to upgrade the project to Spring Boot 2.4.0 with Spring Cloud Vault 3.0.0-SNAPSHOT version, the properties are not being replaced
bootstrap.yml
spring:
cloud:
vault:
authentication: APPROLE
app-role:
role-id: ${role-id}
secret-id: ${secret-id}
role: pres-read
app-role-path: approle
uri: ${vault-server}
connection-timeout: 5000
read-timeout: 15000
kv:
enabled: true
backend: secret
application-name: app/pres
application.yml
spring:
config:
activate:
on-profile: 'demo'
application-demo.yml
## Server Properties
server:
port: 8081
spring:
datasource:
username: ${pres.db.username}
password: ${pres.db.password}
url: ${pres.db.url}
Spring Cloud Vault Library
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
Error Log:
/Users/jaddap2/Library/Java/JavaVirtualMachines/adopt-openj9-11.0.9/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59487,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.profiles.active=demo -Dspring.output.ansi.enabled=always -Drole_id=49c8d8fb-1bdd-7f3b-493f-a11e20907a62 -Dsecret_id=a7ee91cc-e259-82ff-2b34-5c333dda300c -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Users/jaddap2/Library/Caches/JetBrains/IntelliJIdea2020.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /Users/jaddap2/IdeaProjects/HashiCorpVault-SpringCloud/target/classes:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.4.0/spring-boot-starter-data-jpa-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.4.0/spring-boot-starter-aop-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-aop/5.3.1/spring-aop-5.3.1.jar:/Users/jaddap2/.m2/repository/org/aspectj/aspectjweaver/1.9.6/aspectjweaver-1.9.6.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.4.0/spring-boot-starter-jdbc-2.4.0.jar:/Users/jaddap2/.m2/repository/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-jdbc/5.3.1/spring-jdbc-5.3.1.jar:/Users/jaddap2/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/Users/jaddap2/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/Users/jaddap2/.m2/repository/org/hibernate/hibernate-core/5.4.23.Final/hibernate-core-5.4.23.Final.jar:/Users/jaddap2/.m2/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar:/Users/jaddap2/.m2/repository/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar:/Users/jaddap2/.m2/repository/net/bytebuddy/byte-buddy/1.10.18/byte-buddy-1.10.18.jar:/Users/jaddap2/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/jaddap2/.m2/repository/org/jboss/jandex/2.1.3.Final/jandex-2.1.3.Final.jar:/Users/jaddap2/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/jaddap2/.m2/repository/org/dom4j/dom4j/2.1.3/dom4j-2.1.3.jar:/Users/jaddap2/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.1.2.Final/hibernate-commons-annotations-5.1.2.Final.jar:/Users/jaddap2/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3/jaxb-runtime-2.3.3.jar:/Users/jaddap2/.m2/repository/org/glassfish/jaxb/txw2/2.3.3/txw2-2.3.3.jar:/Users/jaddap2/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar:/Users/jaddap2/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/Users/jaddap2/.m2/repository/org/springframework/data/spring-data-jpa/2.4.1/spring-data-jpa-2.4.1.jar:/Users/jaddap2/.m2/repository/org/springframework/data/spring-data-commons/2.4.1/spring-data-commons-2.4.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-orm/5.3.1/spring-orm-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-context/5.3.1/spring-context-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-tx/5.3.1/spring-tx-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-beans/5.3.1/spring-beans-5.3.1.jar:/Users/jaddap2/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-aspects/5.3.1/spring-aspects-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.4.0/spring-boot-starter-web-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter/2.4.0/spring-boot-starter-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.4.0/spring-boot-starter-logging-2.4.0.jar:/Users/jaddap2/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/jaddap2/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/jaddap2/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.13.3/log4j-to-slf4j-2.13.3.jar:/Users/jaddap2/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar:/Users/jaddap2/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/jaddap2/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/jaddap2/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.4.0/spring-boot-starter-json-2.4.0.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.11.3/jackson-databind-2.11.3.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.11.3/jackson-annotations-2.11.3.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.11.3/jackson-core-2.11.3.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.11.3/jackson-datatype-jdk8-2.11.3.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.11.3/jackson-datatype-jsr310-2.11.3.jar:/Users/jaddap2/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.11.3/jackson-module-parameter-names-2.11.3.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.4.0/spring-boot-starter-tomcat-2.4.0.jar:/Users/jaddap2/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar:/Users/jaddap2/.m2/repository/org/glassfish/jakarta.el/3.0.3/jakarta.el-3.0.3.jar:/Users/jaddap2/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.39/tomcat-embed-websocket-9.0.39.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-web/5.3.1/spring-web-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-webmvc/5.3.1/spring-webmvc-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-expression/5.3.1/spring-expression-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/cloud/spring-cloud-starter-vault-config/3.0.0-SNAPSHOT/spring-cloud-starter-vault-config-3.0.0-20201123.200715-420.jar:/Users/jaddap2/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/Users/jaddap2/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar:/Users/jaddap2/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/Users/jaddap2/.m2/repository/org/springframework/cloud/spring-cloud-starter/3.0.0-SNAPSHOT/spring-cloud-starter-3.0.0-20201123.160603-486.jar:/Users/jaddap2/.m2/repository/org/springframework/cloud/spring-cloud-context/3.0.0-SNAPSHOT/spring-cloud-context-3.0.0-20201123.160522-488.jar:/Users/jaddap2/.m2/repository/org/springframework/security/spring-security-crypto/5.4.1/spring-security-crypto-5.4.1.jar:/Users/jaddap2/.m2/repository/org/springframework/cloud/spring-cloud-commons/3.0.0-SNAPSHOT/spring-cloud-commons-3.0.0-20201123.160533-486.jar:/Users/jaddap2/.m2/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar:/Users/jaddap2/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar:/Users/jaddap2/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar:/Users/jaddap2/.m2/repository/org/springframework/cloud/spring-cloud-vault-config/3.0.0-SNAPSHOT/spring-cloud-vault-config-3.0.0-20201123.200557-420.jar:/Users/jaddap2/.m2/repository/org/springframework/vault/spring-vault-core/2.3.0-M1/spring-vault-core-2.3.0-M1.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-devtools/2.4.0/spring-boot-devtools-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot/2.4.0/spring-boot-2.4.0.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.4.0/spring-boot-autoconfigure-2.4.0.jar:/Users/jaddap2/.m2/repository/mysql/mysql-connector-java/8.0.22/mysql-connector-java-8.0.22.jar:/Users/jaddap2/.m2/repository/org/springframework/boot/spring-boot-configuration-processor/2.4.0/spring-boot-configuration-processor-2.4.0.jar:/Users/jaddap2/.m2/repository/org/projectlombok/lombok/1.18.16/lombok-1.18.16.jar:/Users/jaddap2/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/Users/jaddap2/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-core/5.3.1/spring-core-5.3.1.jar:/Users/jaddap2/.m2/repository/org/springframework/spring-jcl/5.3.1/spring-jcl-5.3.1.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar com.pj.vaultdemo.VaultDemoApplication
Connected to the target VM, address: '127.0.0.1:59487', transport: 'socket'
{spring.web.resources.chain.cache=false, spring.web.resources.cache.period=0}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.0)
2020-11-24 14:57:53.788 INFO 95795 --- [ restartedMain] com.pj.vaultdemo.VaultDemoApplication : Starting VaultDemoApplication using Java 11.0.9 on macOsMachine with PID 95795 (/Users/jaddap2/IdeaProjects/HashiCorpVault-SpringCloud/target/classes started by jaddap2 in /Users/jaddap2/IdeaProjects/HashiCorpVault-SpringCloud)
2020-11-24 14:57:53.792 INFO 95795 --- [ restartedMain] com.pj.vaultdemo.VaultDemoApplication : The following profiles are active: demo
2020-11-24 14:57:53.895 INFO 95795 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-24 14:57:53.895 INFO 95795 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-11-24 14:57:54.904 INFO 95795 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-11-24 14:57:54.962 INFO 95795 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 48 ms. Found 1 JPA repository interfaces.
2020-11-24 14:57:55.300 INFO 95795 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=80a5ef39-fa0c-39ac-928e-c0ba95b06c78
2020-11-24 14:57:56.347 INFO 95795 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2020-11-24 14:57:56.358 INFO 95795 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-11-24 14:57:56.359 INFO 95795 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-11-24 14:57:56.490 INFO 95795 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-11-24 14:57:56.491 INFO 95795 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2594 ms
2020-11-24 14:57:56.580 WARN 95795 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$JpaInvokerConfiguration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
2020-11-24 14:57:56.585 INFO 95795 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-11-24 14:57:56.627 INFO 95795 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-24 14:57:56.661 ERROR 95795 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$JpaInvokerConfiguration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:429) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1780) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$247/000000000000000000.getObject(Unknown Source) ~[na:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1161) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.0.jar:2.4.0]
at com.pj.vaultdemo.VaultDemoApplication.main(VaultDemoApplication.java:11) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.0.jar:2.4.0]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$247/000000000000000000.getObject(Unknown Source) ~[na:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$JpaInvokerConfiguration.init(RefreshAutoConfiguration.java:131) ~[spring-cloud-context-3.0.0-20201123.160522-488.jar:3.0.0-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.3.1.jar:5.3.1]
... 25 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$247/000000000000000000.getObject(Unknown Source) ~[na:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1367) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfUnique(DefaultListableBeanFactory.java:2050) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker.getDataSourceInitializer(DataSourceInitializerInvoker.java:98) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker.afterPropertiesSet(DataSourceInitializerInvoker.java:61) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.1.jar:5.3.1]
... 40 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.1.jar:5.3.1]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.3.1.jar:5.3.1]
... 57 common frames omitted
Caused by: java.lang.IllegalArgumentException: URL must start with 'jdbc'
at org.springframework.util.Assert.isTrue(Assert.java:121) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.boot.jdbc.DatabaseDriver.fromJdbcUrl(DatabaseDriver.java:283) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:229) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:176) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90) ~[spring-boot-autoconfigure-2.4.0.jar:2.4.0]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.1.jar:5.3.1]
... 58 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:59487', transport: 'socket'
Process finished with exit code 0

As pointed put by Nicoll, With Spring Cloud Vault 3.0 and Spring Boot 2.4, the bootstrap context initialization (bootstrap.yml, bootstrap.properties) of property sources was deprecated. This can be fixed in one of the 2 ways
Use Spring Boot 2.4.0 Config Data API to import configuration from Vault (Preferred)
Legacy Processing: Enable the bootstrap context either by setting the configuration property spring.cloud.bootstrap.enabled=true or by including the dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
1. Use Spring Boot 2.4.0 Config Data API (Preferred)
Move bootstrap.yml configuration to application.yml and updated file looks like below
application.yml
spring:
cloud:
vault:
authentication: APPROLE
app-role:
role-id: ${role-id}
secret-id: ${secret-id}
role: pres-read
app-role-path: approle
uri: ${vault-server}
connection-timeout: 5000
read-timeout: 15000
config:
import: vault://secret/app/pres/
And define individual profiles as shown below. Add spring.config.import: vault://secret/app/pres/demo property.
application-demo.yml
## Server Properties
server:
port: 8081
spring:
config:
import: vault://secret/app/pres/demo
datasource:
username: ${pres.db.username}
password: ${pres.db.password}
url: ${pres.db.url}
driver-class-name: com.mysql.cj.jdbc.Driver
Repeat the same process for all profiles like dev, test, qc, staging and prod.
2. Legacy Processing:
Add the following dependency if you still want to use bootstrap.yml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
to the project. The issue will be resolved.
See Spring Cloud Vault docs for more information

I spent a whole day trying to resolve this issue.
For everyone who is following any outdated cloud tutorials:- from springboot 2.4 bootstrap starter dependency has to be added, to follow along the tutorial to use bootstrap.properties (bootstrap.yml) for external configuration.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>

Related

Can I run an empty spring boot application without getting an Error?

I just Created this file from spring.initializer.
It is a brand new file. I am trying to run this because I have a previous project that have similar type of error. So I thought of making a new project and see if any error comes. below i the Error
My Error
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.3)
2022-09-08 20:15:36.021 INFO 8344 --- [ main] c.m.w.webproject.WebProjectApplication : Starting WebProjectApplication using Java 17.0.4 on DESKTOP-4LDNK11 with PID 8344 (C:\Users\Lenovo\Documents\JAVA\WebProject\target\classes started by Lenovo in C:\Users\Lenovo\Documents\JAVA\WebProject)
2022-09-08 20:15:36.027 INFO 8344 --- [ main] c.m.w.webproject.WebProjectApplication : No active profile set, falling back to 1 default profile: "default"
2022-09-08 20:15:37.266 INFO 8344 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-09-08 20:15:37.297 INFO 8344 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11 ms. Found 0 JPA repository interfaces.
2022-09-08 20:15:38.269 INFO 8344 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-09-08 20:15:38.283 INFO 8344 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-09-08 20:15:38.284 INFO 8344 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-09-08 20:15:38.489 INFO 8344 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-09-08 20:15:38.490 INFO 8344 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2328 ms
2022-09-08 20:15:38.732 WARN 8344 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/model/naming/CamelCaseToUnderscoresNamingStrategy
2022-09-08 20:15:38.737 INFO 8344 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-09-08 20:15:38.755 INFO 8344 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-08 20:15:38.789 ERROR 8344 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/model/naming/CamelCaseToUnderscoresNamingStrategy
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.22.jar:5.3.22]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.3.jar:2.7.3]
at com.mandeep.web.webproject.WebProjectApplication.main(WebProjectApplication.java:10) ~[classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/model/naming/CamelCaseToUnderscoresNamingStrategy
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.22.jar:5.3.22]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.22.jar:5.3.22]
... 19 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/model/naming/CamelCaseToUnderscoresNamingStrategy
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties$Naming.lambda$applyNamingStrategies$1(HibernateProperties.java:178) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties$Naming.lambda$applyNamingStrategy$2(HibernateProperties.java:187) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220) ~[na:na]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties$Naming.applyNamingStrategy(HibernateProperties.java:187) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties$Naming.applyNamingStrategies(HibernateProperties.java:177) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties$Naming.access$000(HibernateProperties.java:146) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.getAdditionalProperties(HibernateProperties.java:102) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineHibernateProperties(HibernateProperties.java:95) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.getVendorProperties(HibernateJpaConfiguration.java:132) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:132) ~[spring-boot-autoconfigure-2.7.3.jar:2.7.3]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.22.jar:5.3.22]
... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
... 35 common frames omitted
Process finished with exit code 1
My POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mandeep.web.webproject</groupId>
<artifactId>WebProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>WebProject</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My properties file
spring.datasource.url=jdbc:mysql://localhost:3306/WebProject
spring.datasource.username=root
spring.datasource.password=Sciman$#2569
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
connection.pool.initialPoolSize=1
connection.pool.minPoolSize=1
connection.pool.maxPoolSize=20
connection.pool.maxIdleTime=3000
My Application File
package com.mandeep.web.webproject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class WebProjectApplication {
public static void main(String[] args) {
SpringApplication.run(WebProjectApplication.class, args);
}
}
I See this
java.lang.NoClassDefFoundError: org/hibernate/boot/model/naming/CamelCaseToUnderscoresNamingStrategy
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
Couple of solutions
Check if you have this class CamelCaseToUnderscoresNamingStrategy under your Maven dependencies -> org.hibernate dependency -> path boot/model/naming
If you can't locate that class, add a hibernate dependency with version >= 5.5.4
Check if this article helps Spring boot application and hibernate are using different naming strategies
I deleted the Hibernate folder from C:\Users{User}.m2\repository.
Then I added below dependency in the pom file.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.5.4.Final</version>
</dependency>
Also add version to maven plugin -:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
**<version>${project.parent.version}</version>**
</plugin>
Do the above steps if anyone gets the same Error.

Spring Boot can't find beans.xml in resources folder

I need to display beans on view but it give exception.
Maven project structure:
Here is my code and I don't know why it can't find beans.xml
Player class
package kuraido.beansspring;
public class Player {
String nickname;
String level;
public Player(String level, String nickname){
this.level = level;
this.nickname = nickname;
}
#Override
public String toString(){
return "Player's level and nick name: " + level + " " + nickname;
}
}
PlayerController Class(to display bean xml)
package kuraido.beansspring;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class PlayerController {
static ApplicationContext context = new FileSystemXmlApplicationContext("beans.xml");
#RequestMapping("/")
public String peeji(){
return context.getBean("player1").toString();
}
}
beans.xml file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="player1" class="kuraido.beansspring.Player">
<constructor-arg index="0" value="99"/>
<constructor-arg index="1" value="N00bly"/>
</bean>
<bean id="player2" class="kuraido.beansspring.Player">
<constructor-arg index="0" value="1"/>
<constructor-arg index="1" value="Garfunkel"/>
</bean>
</beans>
I haven't modified the generic Application class, it stayed untouched
and here is the exception message:
2022-03-26 00:16:26.463 INFO 6700 --- [ main] k.beansspring.BeansspringApplication : No active profile set, falling back to 1 default profile: "default"
2022-03-26 00:16:27.165 INFO 6700 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-03-26 00:16:27.171 INFO 6700 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-03-26 00:16:27.171 INFO 6700 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]
2022-03-26 00:16:27.253 INFO 6700 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-03-26 00:16:27.253 INFO 6700 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 739 ms
2022-03-26 00:16:27.288 WARN 6700 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'playerController' defined in file [C:\Users\Clyde\Desktop\Github\taihenJanai\assignment4\target\classes\kuraido\beansspring\PlayerController.class]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
2022-03-26 00:16:27.290 INFO 6700 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-03-26 00:16:27.299 INFO 6700 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-03-26 00:16:27.317 ERROR 6700 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'playerController' defined in file [C:\Users\Clyde\Desktop\Github\taihenJanai\assignment4\target\classes\kuraido\beansspring\PlayerController.class]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.5.jar:2.6.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.5.jar:2.6.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.5.jar:2.6.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.5.jar:2.6.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.5.jar:2.6.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.5.jar:2.6.5]
at kuraido.beansspring.BeansspringApplication.main(BeansspringApplication.java:10) ~[classes/:na]
Caused by: java.lang.ExceptionInInitializerError: null
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.17.jar:5.3.17]
... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [C:\Users\Clyde\Desktop\Github\taihenJanai\assignment4\beans.xml]; nested exception is java.io.FileNotFoundException: beans.xml
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:196) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:232) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:203) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:265) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:671) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:142) ~[spring-context-5.3.17.jar:5.3.17]
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:85) ~[spring-context-5.3.17.jar:5.3.17]
at kuraido.beansspring.PlayerController.<clinit>(PlayerController.java:11) ~[classes/:na]
... 25 common frames omitted
Caused by: java.io.FileNotFoundException: beans.xml
at org.springframework.core.io.FileSystemResource.getInputStream(FileSystemResource.java:189) ~[spring-core-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:333) ~[spring-beans-5.3.17.jar:5.3.17]
... 38 common frames omitted
Process finished with exit code 1
You should try this ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); instead of this ApplicationContext context = new FileSystemXmlApplicationContext("beans.xml");

Java Spring application won't run in debug mode

I'm a frontend developer so my knowledge of Java, Spring and IntelliJ is virtually zero.
I accidentally deleted my company's repo on my local machine so I re-cloned it back from GitHub. I was unable to click the "debug" button as it was grayed out so I asked a colleague what their Run/Debug configurations were and added it to my editor.
Normally, I would click on "debug" and it would run and work with the frontend, but now when I run it this is the error I receive:
updated based on Kaj Hejer recommendation:
Connected to the target VM, address: '127.0.0.1:60174', transport: 'socket'
2021-03-31 13:02:22.350 INFO ['casino-api':main::] c.company.casinoapi.CasinoApiApplication - Starting CasinoApiApplication on Marks-MacBook-Pro.local with PID 7352 (/Users/work/Documents/casino-api/target/classes started by work in /Users/work/Documents/casino-api)
2021-03-31 13:02:22.353 INFO ['casino-api':main::] c.company.casinoapi.CasinoApiApplication - The following profiles are active: local
2021-03-31 13:02:23.781 INFO ['casino-api':main::] o.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
2021-03-31 13:02:23.781 INFO ['casino-api':main::] org.apache.catalina.core.StandardService - Starting service [Tomcat]
2021-03-31 13:02:23.781 INFO ['casino-api':main::] org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.31]
2021-03-31 13:02:23.870 INFO ['casino-api':main::] o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2021-03-31 13:02:23.871 INFO ['casino-api':main::] o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1480 ms
2021-03-31 13:02:24.171 INFO ['casino-api':main::] io.lettuce.core.EpollProvider - Starting without optional epoll library
2021-03-31 13:02:24.171 INFO ['casino-api':main::] io.lettuce.core.KqueueProvider - Starting without optional kqueue library
2021-03-31 13:02:24.418 INFO ['casino-api':main::] o.f.core.internal.license.VersionPrinter - Flyway Community Edition 6.0.8 by Redgate
2021-03-31 13:02:24.423 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2021-03-31 13:02:24.483 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2021-03-31 13:02:24.500 INFO ['casino-api':main::] o.f.c.internal.database.DatabaseFactory - Database: jdbc:mysql://0.0.0.0:4306/api (MySQL 10.4)
2021-03-31 13:02:24.570 INFO ['casino-api':main::] o.f.core.internal.command.DbValidate - Successfully validated 3 migrations (execution time 00:00.019s)
2021-03-31 13:02:24.583 INFO ['casino-api':main::] o.f.core.internal.command.DbMigrate - Current version of schema `api`: 2
2021-03-31 13:02:24.583 WARN ['casino-api':main::] o.f.core.internal.command.DbMigrate - Schema `api` has a version (2) that is newer than the latest available migration (1) !
2021-03-31 13:02:24.585 INFO ['casino-api':main::] o.f.core.internal.command.DbMigrate - Schema `api` is up to date. No migration necessary.
2021-03-31 13:02:24.674 INFO ['casino-api':main::] o.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
2021-03-31 13:02:24.741 INFO ['casino-api':main::] org.hibernate.Version - HHH000412: Hibernate Core {5.4.10.Final}
2021-03-31 13:02:24.871 INFO ['casino-api':main::] org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2021-03-31 13:02:24.981 INFO ['casino-api':main::] org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MariaDBDialect
2021-03-31 13:02:25.139 WARN ['casino-api':main::] org.hibernate.cfg.AnnotationBinder - HHH000457: Joined inheritance hierarchy [com.company.casinoapi.model.game.GameLog] defined explicit #DiscriminatorColumn. Legacy Hibernate behavior was to ignore the #DiscriminatorColumn. However, as part of issue HHH-6911 we now apply the explicit #DiscriminatorColumn. If you would prefer the legacy behavior, enable the `hibernate.discriminator.ignore_explicit_for_joined` setting (hibernate.discriminator.ignore_explicit_for_joined=true)
2021-03-31 13:02:25.893 INFO ['casino-api':main::] o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-03-31 13:02:26.260 WARN ['casino-api':main::] o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-03-31 13:02:26.502 WARN ['casino-api':main::] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameReportController': Unsatisfied dependency expressed through field 'jwtAuthenticator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
2021-03-31 13:02:26.505 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2021-03-31 13:02:26.522 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
2021-03-31 13:02:26.550 INFO ['casino-api':main::] org.apache.catalina.core.StandardService - Stopping service [Tomcat]
2021-03-31 13:02:26.564 ERROR ['casino-api':main::] o.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameReportController': Unsatisfied dependency expressed through field 'jwtAuthenticator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.company.casinoapi.CasinoApiApplication.main(CasinoApiApplication.java:10)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
... 19 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
... 32 common frames omitted
Caused by: java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:370)
at java.base/java.nio.file.Files.newByteChannel(Files.java:421)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
at java.base/java.nio.file.Files.newInputStream(Files.java:155)
at java.base/java.nio.file.Files.newBufferedReader(Files.java:2838)
at java.base/java.nio.file.Files.readAllLines(Files.java:3329)
at com.company.casinoapi.bean.JWTAuthenticator.<init>(JWTAuthenticator.java:28)
at com.company.casinoapi.config.JWTAuthConfig.globalJWTConfig(JWTAuthConfig.java:17)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081.CGLIB$globalJWTConfig$0(<generated>)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081$$FastClassBySpringCGLIB$$f2f1d21b.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081.globalJWTConfig(<generated>)
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:566)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 33 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:60174', transport: 'socket'
Process finished with exit code 1
In the stacktrace you can see the following:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lettuce.core.api.StatefulRedisConnection]: Factory method 'connection' threw exception; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 0.0.0.0:6380
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
... 96 common frames omitted
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 0.0.0.0:6380
at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:7
It looks like you app is trying to connect to a redis-server. I suggest you hear with your colleague how they start the redis-server.
First you need to add api-engine-secret.key file to your project in the path src/main/resources/secrets, maybe this file not pushed to GitHub repository, So you need to get it from a colleague.

Strange Error: Beans not created, "Can not configure endpoints"

So, thiss error appears in one of my team-members IntelliJ.
Anyone faced this or similar problem before?
Same code runs with no problems on my pc on intelliJ with same settings and 2 others with mac, also tried installing on another pc and no problem.
It's a big project, so you would need to ask for any code that would be helpfull.
But still, the code should be ok because of running on several other machines.
We checked javaversion in project settings, he got 8.241 and me 8.211. Trying the 8.211 didn't help.
We checked java path in windows env variables, seems ok.
We tried reinstall IntelliJ.
We tried remove git repo, then new clone from bitBucket.
We tried maven refresh/update
We tried removing the .m2 folder
We tried another computer (this one had same login though as the team-members pc that wont work)
We checked env.variables in project
We checked pom.xml
Everything seems ok, but application won't run.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.5.RELEASE)
2020-03-23 16:45:31.820 INFO 12592 --- [ main] se.companyName.appName.appNameApplication : Starting appNameApplication on computer with PID 12592 (C:\git-repos\appName-api\target\classes started by myUserName in C:\git-repos\appName-api)
2020-03-23 16:45:31.858 DEBUG 12592 --- [ main] se.companyName.appName.appNameApplication : Running with Spring Boot v2.1.5.RELEASE, Spring v5.1.7.RELEASE
2020-03-23 16:45:31.860 INFO 12592 --- [ main] se.companyName.appName.appNameApplication : No active profile set, falling back to default profiles: default
2020-03-23 16:45:34.317 INFO 12592 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2020-03-23 16:45:34.600 INFO 12592 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 257ms. Found 3 repository interfaces.
2020-03-23 16:45:35.751 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$349c9192] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:35.867 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$cd4a59cc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:35.892 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:35.897 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#378f002a' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:35.906 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$f21efc7e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:35.915 INFO 12592 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-03-23 16:45:36.643 INFO 12592 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-03-23 16:45:36.699 INFO 12592 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-23 16:45:36.700 INFO 12592 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
2020-03-23 16:45:37.229 INFO 12592 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-23 16:45:37.356 DEBUG 12592 --- [ main] s.h.a.security.filter.UserStatusFilter : Filter 'userStatusFilter' configured for use
2020-03-23 16:45:37.913 INFO 12592 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-03-23 16:45:38.818 INFO 12592 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-03-23 16:45:42.256 INFO 12592 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-03-23 16:45:43.980 WARN 12592 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot configure enpdoints
2020-03-23 16:45:44.003 INFO 12592 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-03-23 16:45:44.008 INFO 12592 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-03-23 16:45:44.026 INFO 12592 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-03-23 16:45:44.029 INFO 12592 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-03-23 16:45:44.056 INFO 12592 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-23 16:45:44.093 ERROR 12592 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot configure enpdoints
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at se.companyName.appName.appNameApplication.main(appNameApplication.java:17) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Cannot configure enpdoints
at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration.init(AuthorizationServerEndpointsConfiguration.java:81) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
... 18 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessTokenConverter' defined in class path resource [se/companyName/appName/security/config/AuthorizationServerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'accessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: failed to construct sequence from byte[]: DER length more than 4 bytes: 18
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:394) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:366) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at se.companyName.appName.security.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$c09734a8.accessTokenConverter(<generated>) ~[classes/:na]
at se.companyName.appName.security.config.AuthorizationServerConfig.configure(AuthorizationServerConfig.java:66) ~[classes/:na]
at org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration.init(AuthorizationServerEndpointsConfiguration.java:79) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
... 25 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'accessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: failed to construct sequence from byte[]: DER length more than 4 bytes: 18
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
... 39 common frames omitted
Caused by: java.lang.IllegalArgumentException: failed to construct sequence from byte[]: DER length more than 4 bytes: 18
at org.bouncycastle.asn1.ASN1Sequence.getInstance(Unknown Source) ~[bcprov-jdk15on-1.56.jar:1.56.0]
at org.springframework.security.jwt.crypto.sign.RsaKeyHelper.parseKeyPair(RsaKeyHelper.java:56) ~[spring-security-jwt-1.0.9.RELEASE.jar:na]
at org.springframework.security.jwt.crypto.sign.RsaSigner.loadPrivateKey(RsaSigner.java:77) ~[spring-security-jwt-1.0.9.RELEASE.jar:na]
at org.springframework.security.jwt.crypto.sign.RsaSigner.<init>(RsaSigner.java:48) ~[spring-security-jwt-1.0.9.RELEASE.jar:na]
at org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.setSigningKey(JwtAccessTokenConverter.java:177) ~[spring-security-oauth2-2.3.5.RELEASE.jar:na]
at se.companyName.appName.security.config.AuthorizationServerConfig.accessTokenConverter(AuthorizationServerConfig.java:87) ~[classes/:na]
at se.companyName.appName.security.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$c09734a8.CGLIB$accessTokenConverter$3(<generated>) ~[classes/:na]
at se.companyName.appName.security.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$c09734a8$$FastClassBySpringCGLIB$$616eb46b.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at se.companyName.appName.security.config.AuthorizationServerConfig$$EnhancerBySpringCGLIB$$c09734a8.accessTokenConverter(<generated>) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
... 40 common frames omitted
Process finished with exit code 1
Caused by: java.lang.IllegalArgumentException: failed to construct sequence from byte[]: DER length more than 4 bytes: 18
at org.bouncycastle.asn1.ASN1Sequence.getInstance(Unknown Source) ~[bcprov-jdk15on-1.56.jar:1.56.0]
It looks like that the Self signed certificate or the PEM file is NOT present as expected in your setup. Checkout those files once, PEM file should not be encrypted.
Use the same SSL engine which was used to create those.

BeanCreationException IntelliJ

I am a little lost with this - below is my code...when I run it via IntelliJ debug mode, my Spring app fails to initialize with the following error...
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportController' defined in file [my_code_directory/ic/cybs/target/classes/com/ic/cybs/controller/ReportController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ic.cybs.controller.ReportController]: Constructor threw exception; nested exception is java.lang.NullPointerException
I am not sure why the Constructor is throwing an exception, the error is being thrown by this line in ReportController.java
private Properties mProp = Configuration.getMDetails();
ReportController.java
package com.ic.cybs.controller;
import com.cybs.authsdk.core.ConfigException;
import com.cybs.authsdk.core.MercConfig;
import com.ic.cybs.config.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Properties;
#RestController
#RequestMapping("/v1/cybs")
public class ReportController {
// constructor
public ReportController() throws ConfigException { }
// private
private Properties mProp = Configuration.getMDetails();
private MercConfig mercConfig = new MercConfig(mProp);
// public
#GetMapping("/")
public String getIndex() {
return String.format("%s", HttpStatus.OK);
}
}
Configuration.java
package com.ic.cybs.config;
import java.util.Properties;
public class Configuration {
// constructor
// private
// public
public static Properties getMDetails() {
Properties properties = new Properties();
// HTTP_Signature = http_signature
properties.setProperty("authenticationType", "http_signature");
properties.setProperty("mID", System.getenv("M_ID"));
properties.setProperty("runEnvironment", System.getenv("ENVIRONMENT"));
properties.setProperty("requestJsonPath", "src/main/resources/request.json");
// HTTP Parameters
properties.setProperty("mKeyId", System.getenv("KEY_ID"));
properties.setProperty("mSecretKey", System.getenv("SECRET_KEY"));
// Logging to be enabled or not.
properties.setProperty("enableLog", "true");
// Log directory Path
properties.setProperty("logDirectory", "log");
properties.setProperty("logFilename", "cybs");
// Log file size in KB
properties.setProperty("logMaximumSize", "5M");
return properties;
}
}
Can someone please tell me why I am getting this error...
Also please note that "Properties getMDetails()" is a public static method, therefore an actual constructor is not needed...
Below is the complete stack trace...
/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:56711,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Users/me/Library/Caches/IntelliJIdea2019.1/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "/Users/me/_code/ic/cybs/target/classes:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.2.0.M4/spring-boot-starter-actuator-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter/2.2.0.M4/spring-boot-starter-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot/2.2.0.M4/spring-boot-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.0.M4/spring-boot-autoconfigure-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.2.0.M4/spring-boot-starter-logging-2.2.0.M4.jar:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/me/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/Users/me/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/Users/me/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.4/jakarta.annotation-api-1.3.4.jar:/Users/me/.m2/repository/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.2.0.M4/spring-boot-actuator-autoconfigure-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.M4/spring-boot-actuator-2.2.0.M4.jar:/Users/me/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9.jar:/Users/me/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/me/.m2/repository/org/springframework/spring-context/5.2.0.M3/spring-context-5.2.0.M3.jar:/Users/me/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.9/jackson-datatype-jsr310-2.9.9.jar:/Users/me/.m2/repository/io/micrometer/micrometer-core/1.1.5/micrometer-core-1.1.5.jar:/Users/me/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/me/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.2.0.M4/spring-boot-starter-web-2.2.0.M4.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.2.0.M4/spring-boot-starter-json-2.2.0.M4.jar:/Users/me/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.9/jackson-datatype-jdk8-2.9.9.jar:/Users/me/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.9/jackson-module-parameter-names-2.9.9.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.0.M4/spring-boot-starter-tomcat-2.2.0.M4.jar:/Users/me/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar:/Users/me/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.21/tomcat-embed-el-9.0.21.jar:/Users/me/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.21/tomcat-embed-websocket-9.0.21.jar:/Users/me/.m2/repository/org/springframework/boot/spring-boot-starter-validation/2.2.0.M4/spring-boot-starter-validation-2.2.0.M4.jar:/Users/me/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.1/jakarta.validation-api-2.0.1.jar:/Users/me/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.17.Final/hibernate-validator-6.0.17.Final.jar:/Users/me/.m2/repository/org/jboss/logging/jboss-logging/3.4.0.Final/jboss-logging-3.4.0.Final.jar:/Users/me/.m2/repository/com/fasterxml/classmate/1.5.0/classmate-1.5.0.jar:/Users/me/.m2/repository/org/springframework/spring-web/5.2.0.M3/spring-web-5.2.0.M3.jar:/Users/me/.m2/repository/org/springframework/spring-beans/5.2.0.M3/spring-beans-5.2.0.M3.jar:/Users/me/.m2/repository/org/springframework/spring-webmvc/5.2.0.M3/spring-webmvc-5.2.0.M3.jar:/Users/me/.m2/repository/org/springframework/spring-aop/5.2.0.M3/spring-aop-5.2.0.M3.jar:/Users/me/.m2/repository/org/springframework/spring-expression/5.2.0.M3/spring-expression-5.2.0.M3.jar:/Users/me/.m2/repository/org/projectlombok/lombok/1.18.8/lombok-1.18.8.jar:/Users/me/.m2/repository/org/springframework/spring-core/5.2.0.M3/spring-core-5.2.0.M3.jar:/Users/me/.m2/repository/org/springframework/spring-jcl/5.2.0.M3/spring-jcl-5.2.0.M3.jar:/Users/me/.m2/repository/com/cybs/AuthenticationSdk/0.0.5/AuthenticationSdk-0.0.5.jar:/Users/me/.m2/repository/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar:/Users/me/.m2/repository/com/nimbusds/nimbus-jose-jwt/4.22/nimbus-jose-jwt-4.22.jar:/Users/me/.m2/repository/com/github/stephenc/jcip/jcip-annotations/1.0-1/jcip-annotations-1.0-1.jar:/Users/me/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar:/Users/me/.m2/repository/net/minidev/asm/1.0.2/asm-1.0.2.jar:/Users/me/.m2/repository/asm/asm/3.3.1/asm-3.3.1.jar:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2.jar:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-1.2-api/2.11.2/log4j-1.2-api-2.11.2.jar:/Users/me/.m2/repository/net/minidev/json-smart/1.0.9/json-smart-1.0.9.jar:/Users/me/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar:/Users/me/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/Users/me/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/me/.m2/repository/io/vertx/vertx-core/3.5.3/vertx-core-3.5.3.jar:/Users/me/.m2/repository/io/netty/netty-common/4.1.36.Final/netty-common-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-buffer/4.1.36.Final/netty-buffer-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-transport/4.1.36.Final/netty-transport-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-handler/4.1.36.Final/netty-handler-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-codec/4.1.36.Final/netty-codec-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-handler-proxy/4.1.36.Final/netty-handler-proxy-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-codec-socks/4.1.36.Final/netty-codec-socks-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-codec-http/4.1.36.Final/netty-codec-http-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-codec-http2/4.1.36.Final/netty-codec-http2-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-resolver/4.1.36.Final/netty-resolver-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-resolver-dns/4.1.36.Final/netty-resolver-dns-4.1.36.Final.jar:/Users/me/.m2/repository/io/netty/netty-codec-dns/4.1.36.Final/netty-codec-dns-4.1.36.Final.jar:/Users/me/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar" com.ic.cybs.cybsApplication
Connected to the target VM, address: '127.0.0.1:56711', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.M4)
2019-07-21 13:34:10.051 INFO 68613 --- [ main] c.i.cybs.cybsApplication : Starting cybsApplication on Didiers-MacBook-Pro-2.local with PID 68613 (/Users/me/_code/ic/cybs/target/classes started by me in /Users/me/_code/ic/cybs)
2019-07-21 13:34:10.054 INFO 68613 --- [ main] c.i.cybs.cybsApplication : No active profile set, falling back to default profiles: default
2019-07-21 13:34:11.183 INFO 68613 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-07-21 13:34:11.190 INFO 68613 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-07-21 13:34:11.191 INFO 68613 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-07-21 13:34:11.256 INFO 68613 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-07-21 13:34:11.256 INFO 68613 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1145 ms
2019-07-21 13:34:11.462 WARN 68613 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportController' defined in file [/Users/me/_code/ic/cybs/target/classes/com/ic/cybs/controller/ReportController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ic.cybs.controller.ReportController]: Constructor threw exception; nested exception is java.lang.NullPointerException
2019-07-21 13:34:11.465 INFO 68613 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-07-21 13:34:11.480 INFO 68613 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-21 13:34:11.487 ERROR 68613 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportController' defined in file [/Users/me/_code/ic/cybs/target/classes/com/ic/cybs/controller/ReportController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ic.cybs.controller.ReportController]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1308) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1202) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:870) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:748) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1227) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1216) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at com.ic.cybs.cybsApplication.main(cybsApplication.java:80) ~[classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ic.cybs.controller.ReportController]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:213) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1300) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
... 17 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) ~[na:na]
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) ~[na:na]
at java.base/java.util.Properties.put(Properties.java:1316) ~[na:na]
at java.base/java.util.Properties.setProperty(Properties.java:225) ~[na:na]
at com.ic.cybs.config.Configuration.getMerchantDetails(Configuration.java:86) ~[classes/:na]
at com.ic.cybs.controller.ReportController.<init>(ReportController.java:90) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[na:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:200) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
... 19 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:56711', transport: 'socket'
Process finished with exit code 1

Categories