Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application fails to start with StackOverflowError #209

Closed
steinwelberg opened this issue Apr 16, 2020 · 22 comments
Closed

Application fails to start with StackOverflowError #209

steinwelberg opened this issue Apr 16, 2020 · 22 comments

Comments

@steinwelberg
Copy link

When I integrate Jasypt version 3.0.2 into my application I receive a StackOverflowError and my application won't start.

Versions:

  • jasypt-spring-boot-starter version 3.0.2
  • spring-boot version 2.2.6.RELEASE
  • spring version 5.2.5.RELEASE

I have followed the steps to integrate Jasypt into my application and when I start the application I see the following stacktrace:

Stacktrace
2020-04-16 08:08:57.806  WARN 82601 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: Factory method 'methodValidationPostProcessor' threw exception; nested exception is java.lang.StackOverflowError
2020-04-16 08:08:57.806  INFO 82601 --- [           main] o.s.s.c.ThreadPoolTaskExecutor           : Shutting down ExecutorService 'threadPoolTaskExecutor'
2020-04-16 08:08:57.819  INFO 82601 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-16 08:08:57.827 ERROR 82601 --- [           main] o.s.b.SpringApplication                  : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: Factory method 'methodValidationPostProcessor' threw exception; nested exception is java.lang.StackOverflowError
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:722) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at com.example.app.Application.main(Application.java:29) [classes/:?]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: Factory method 'methodValidationPostProcessor' threw exception; nested exception is java.lang.StackOverflowError
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	... 19 more
Caused by: java.lang.StackOverflowError
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1012) ~[?:?]
	at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1541) ~[?:?]
	at java.lang.ClassLoader.getClassLoadingLock(ClassLoader.java:667) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:593) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[?:?]
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
	at java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ~[?:?]
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623) ~[?:?]
	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[?:?]
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:380) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:448) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:90) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:79) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:56) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:452) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:572) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:558) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:513) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:450) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:391) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties.bindConfigProps(JasyptEncryptorConfigurationProperties.java:50) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.createDefault(DefaultLazyPropertyFilter.java:41) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$null$2(DefaultLazyPropertyFilter.java:32) ~[jasypt-spring-boot-3.0.2.jar:?]
	at java.util.Optional.orElseGet(Optional.java:369) ~[?:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$new$3(DefaultLazyPropertyFilter.java:26) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.util.Singleton.lambda$new$6(Singleton.java:42) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.util.Singleton.get(Singleton.java:53) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.shouldInclude(DefaultLazyPropertyFilter.java:49) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:18) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:38) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptablePropertySourceWrapper.getProperty(EncryptablePropertySourceWrapper.java:33) ~[jasypt-spring-boot-3.0.2.jar:?]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.find(SpringConfigurationPropertySource.java:111) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.find(SpringConfigurationPropertySource.java:100) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.getConfigurationProperty(SpringConfigurationPropertySource.java:84) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.findConfigurationProperty(ConfigurationPropertySourcesPropertySource.java:65) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.findConfigurationProperty(ConfigurationPropertySourcesPropertySource.java:53) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.getProperty(ConfigurationPropertySourcesPropertySource.java:42) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver.resolvePlaceholder(PropertySourcesPlaceholdersResolver.java:65) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:157) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver.resolvePlaceholders(PropertySourcesPlaceholdersResolver.java:57) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindProperty(Binder.java:434) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:380) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:448) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:90) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:79) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:56) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:452) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:572) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:558) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:513) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:450) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:391) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties.bindConfigProps(JasyptEncryptorConfigurationProperties.java:50) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.createDefault(DefaultLazyPropertyFilter.java:41) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$null$2(DefaultLazyPropertyFilter.java:32) ~[jasypt-spring-boot-3.0.2.jar:?]
	at java.util.Optional.orElseGet(Optional.java:369) ~[?:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$new$3(DefaultLazyPropertyFilter.java:26) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.util.Singleton.lambda$new$6(Singleton.java:42) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.util.Singleton.get(Singleton.java:53) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.shouldInclude(DefaultLazyPropertyFilter.java:49) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:18) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:38) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptablePropertySourceWrapper.getProperty(EncryptablePropertySourceWrapper.java:33) ~[jasypt-spring-boot-3.0.2.jar:?]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.find(SpringConfigurationPropertySource.java:111) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.find(SpringConfigurationPropertySource.java:100) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.getConfigurationProperty(SpringConfigurationPropertySource.java:84) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.findConfigurationProperty(ConfigurationPropertySourcesPropertySource.java:65) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.findConfigurationProperty(ConfigurationPropertySourcesPropertySource.java:53) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource.getProperty(ConfigurationPropertySourcesPropertySource.java:42) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver.resolvePlaceholder(PropertySourcesPlaceholdersResolver.java:65) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:157) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver.resolvePlaceholders(PropertySourcesPlaceholdersResolver.java:57) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindProperty(Binder.java:434) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:380) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:448) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:90) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:79) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:56) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:452) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:572) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:558) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:513) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:450) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:391) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:320) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties.bindConfigProps(JasyptEncryptorConfigurationProperties.java:50) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.createDefault(DefaultLazyPropertyFilter.java:41) ~[jasypt-spring-boot-3.0.2.jar:?]
	at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$null$2(DefaultLazyPropertyFilter.java:32) ~[jasypt-spring-boot-3.0.2.jar:?]
	at java.util.Optional.orElseGet(Optional.java:369) ~[?:?]
...

Before the stacktrace I see the following log message 142 times:

2020-04-16 08:08:57.443  INFO 82601 --- [           main] c.u.j.f.DefaultLazyPropertyFilter        : Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter

And before that I see that my property files get wrapped into the EncryptableMapPropertySourceWrapper object:

2020-04-16 08:08:57.207  INFO 82601 --- [           main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource applicationConfig: [classpath:/application.properties] [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper
@graham-macmaster
Copy link

I'm experiencing the same, starting with version 3.0.1.

Versions:

  • jasypt-spring-boot-starter version 3.0.1
  • spring-boot version 2.2.6.RELEASE
  • spring version 5.2.5.RELEASE

I'm sticking with 3.0.0 for now as I'm not having problems there.

@rupert-madden-abbott
Copy link
Contributor

@gmacster @steinwelberg are you able to upload a minimal example repository that replicates the bug? If so, I can take a look at trying to fix it.

@graham-macmaster
Copy link

@rupert-madden-abbott Minimal example uploaded at https://github.com/gmacster/jasypt-spring-boot-stackoverflowerror

It appears to only be an issue when jasypt.encryptor.password is defined in application.properties with a placeholder referencing another property (e.g. ${some.prop.value}). When I define it as a placeholder referencing an environment variable (e.g. ${some_env_var}), it works fine. Seems like a circular property source reference is getting constructed somehow.

The example has the following versions:

  • jasypt-spring-boot-starter version 3.0.3
  • spring-boot version 2.3.0.RELEASE
  • spring version 5.3.2.RELEASE

@gsakthinarayanan
Copy link

I am facing this issue as well with Spring Boot 2.2.8 and jasypt-spring-boot-starter 3.0.3. I am trying to assign the jasypt encryptor password in application.properties file with the value from PCF Cred Hub service with VCAP property but the application fails to start with StackOverFlow exception.

jasypt.encryptor.password=${vcap.services.pcf-credhub-service.credentials.jasypt-password}

@ulisesbocchio
Copy link
Owner

Try excluding all vcap.* properties from being introspected. Check the readme for details on how to do that

@gsakthinarayanan
Copy link

gsakthinarayanan commented Jun 29, 2020

Try excluding all vcap.* properties from being introspected. Check the readme for details on how to do that

I am confused on which exclusion property to use. Is it one of the below?

jasypt.encryptor.skip-property-sources= 
jasypt.encryptor.property.filter.exclude-names=
jasypt.encryptor.property.filter.exclude-sources=

As mentioned in my previous post, I assign the vcap services value to jasypt.encyptor.password. Isn't jasypt.encryptor already included in the exclusion list by DefaultPropertyFilter?
jasypt.encryptor.password=${vcap.services.pcf-credhub-service.credentials.jasypt-password}

Below is the error that I receive:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: Factory method 'methodValidationPostProcessor' threw exception; nested exception is java.lang.StackOverflowError
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

Thanks in advance for your response.

@ulisesbocchio
Copy link
Owner

you can use:

jasypt.encryptor.property.filter.exclude-names=vcap.services.pcf-credhub-service.credentials.jasypt-password
// or
jasypt.encryptor.property.filter.exclude-names=vcap.services.pcf-credhub-service.credentials.*
// or, if you know the property source name and for instance is called "vcap-services"
jasypt.encryptor.property.filter.exclude-sources=vcap-services

@gsakthinarayanan
Copy link

I tried the above options already but it didn't help. I received the same StackOverflowError and the server failed to start.

@ulisesbocchio
Copy link
Owner

can you provide an example project where this happens? what option above did you actually used? Can I have a full stack trace? In the original stack trace (not from @gsakthinarayanan ) I see that DefaultLazyPropertyFilter is looping but I'm not sure in your case

@ulisesbocchio
Copy link
Owner

@gsakthinarayanan @gmacster @steinwelberg can you try this?

jasypt.encryptor.property.filter.exclude-names=jasypt.encryptor.password

@gsakthinarayanan
Copy link

gsakthinarayanan commented Jul 1, 2020

I tried the above recommendation but still the same error. I created a sample repository that recreates the below issue.

With spring boot jasypt starter 3.0.3 (below issues do not occur with version 2.1.1):

  • When jasypt encryptor password is provided in raw format, the app starts but when the properties is accessed, it throws org.jasypt.exceptions.EncryptionOperationNotPossibleException: null
    stack_trace_jasypt_password_raw.txt

  • When jasypt encryptor password is provided with PCF credhub property value using vcap.services, the app couldn't start at all, even with the exclusion added. It throws the stackoverflow error.
    stack_trace_jasypt_password_vcap_services.txt

Thanks for your response.

@mrlonis
Copy link

mrlonis commented Jul 28, 2020

Any update on this? I am having the same exact issues described above.

Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter

Repeats about 20 times before failing with StackOverflow

@ulisesbocchio
Copy link
Owner

I found the issue. Haven’t had the chance to fix it yet

@mrlonis
Copy link

mrlonis commented Jul 28, 2020

What is the issue?

Also, is there a version where the issue isn't present? I've seen some say version 3.0.0 is fine to use. Should I revert back to version 2.1.2?

@ulisesbocchio
Copy link
Owner

It has to do with the way the beans are lazily initialized. They look for a property but the property kicks in the encryption stuff which triggers to load the filters, and so on until it blows up.

@mister-rao
Copy link

Any update on this issue? I'm getting the same error:

o.s.c.s.AbstractApplicationContext.refresh 558 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration': Unsatisfied dependency expressed through field 'externalConfigurations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurableEnvironmentConfiguration' defined in class path resource [org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration]: Factory method 'configurableEnvironmentConfiguration' threw exception; nested exception is java.lang.StackOverflowError Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'configurableEnvironmentConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference? 00:41:51.790 [main] ERROR o.s.boot.SpringApplication.reportFailure 826 - Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration': Unsatisfied dependency expressed through field 'externalConfigurations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurableEnvironmentConfiguration' defined in class path resource [org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration]: Factory method 'configurableEnvironmentConfiguration' threw exception; nested exception is java.lang.StackOverflowError 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(DefaultSing

@CarlosHerra
Copy link

Same issue here when having the password in a PCF CredHub. Any updates? Thanks!

@maxpavlovdp
Copy link

I have upgraded
from
<jasypt.version>1.7</jasypt.version>
to
<jasypt.version>3.0.3</jasypt.version>

and stackOverflow was fixed.

@mfmarlow
Copy link

mfmarlow commented Apr 6, 2021

having same issue when defining jasypt.encryptor.password as a reference. Using jasypt-spring-boot-starter 3.0.3 with spring boot 2.3.9

@kable-wilmoth
Copy link

Same issue.
SpringBoot 2.3.10.RELEASE
jasypt-spring-boot-starter 3.0.0 - WORKS
jasypt-spring-boot-starter 3.0.1+ - FAILS

application.properties (really yaml)
jasypt.encryptor.password=${some.other.property} - FAILS
jasypt.encryptor.password=value - WORKS

jasypt 3.0.1 release notes:
Usage of replacePlaceHolders instead of replaceRequiredPlaceholders on property resolver to mirror Spring's default behavior

@pvandenbroucke
Copy link

Hello,

Same issue here with spring-boot 2.4.5 -> 2.5.4 and jasypt-spring-boot-starter 3.0.3.

I have a configuration like :
@EncryptablePropertySource(name = "EncryptedProperties", value = "classpath:credentials.properties", ignoreResourceNotFound = true)

The following log and stacktrace happen when the file is not provided :

INFO .EncryptablePropertySourceBeanFactoryPostProcessor [] Loading Encryptable Property Source 'EncryptedProperties'
INFO .EncryptablePropertySourceBeanFactoryPostProcessor [] Ignoring NOT FOUND Encryptable Property Source 'EncryptedProperties' from locations: classpath:credentials.properties
INFO c.u.j.EncryptablePropertySourceConverter [] Skipping PropertySource EncryptedProperties [class com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableEnumerablePropertySourceWrapper
INFO .EncryptablePropertySourceBeanFactoryPostProcessor [] Created Encryptable Property Source 'EncryptedProperties' from locations: [classpath:credentials.properties]
INFO c.u.j.filter.DefaultLazyPropertyFilter [] Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter
INFO c.u.j.filter.DefaultLazyPropertyFilter [] Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter
INFO c.u.j.filter.DefaultLazyPropertyFilter [] Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter
INFO c.u.j.filter.DefaultLazyPropertyFilter [] Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter
...

Caused by: java.lang.StackOverflowError: null
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:379)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:319)
at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:447)
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:95)
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:83)
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:59)
at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:451)
at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:571)
at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:557)
at org.springframework.boot.context.properties.bind.Binder$Context.access$300(Binder.java:512)
at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:449)
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:390)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:319)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:308)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:238)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225)
at com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties.bindConfigProps(JasyptEncryptorConfigurationProperties.java:50)
at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.createDefault(DefaultLazyPropertyFilter.java:41)
at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$null$2(DefaultLazyPropertyFilter.java:32)
at java.util.Optional.orElseGet(Optional.java:267)
at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.lambda$new$3(DefaultLazyPropertyFilter.java:26)
at com.ulisesbocchio.jasyptspringboot.util.Singleton.lambda$new$6(Singleton.java:42)
at com.ulisesbocchio.jasyptspringboot.util.Singleton.get(Singleton.java:53)
at com.ulisesbocchio.jasyptspringboot.filter.DefaultLazyPropertyFilter.shouldInclude(DefaultLazyPropertyFilter.java:49)
at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:18)
at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:41)
at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableEnumerablePropertySourceWrapper.getProperty(EncryptableEnumerablePropertySourceWrapper.java:23)
at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.getConfigurationProperty(SpringConfigurationPropertySource.java:84)

@ulisesbocchio
Copy link
Owner

should go out next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests