ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.93k stars 523 forks source link

GraalVM native app startup with errors. #374

Open yuan2006 opened 1 year ago

yuan2006 commented 1 year ago

My spring boot app can run with jasypt spring boot starter, but it cannot startup if the app is compiled to native image by GraalVM. The native platform is Windows10, exe extension. The following is the logs

11:32:05,798 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [CONSOLE]
11:32:05,798 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:32:05,798 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - This appender no longer admits a layout as a sub-component, set an encoder instead.
11:32:05,798 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
11:32:05,798 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
11:32:05,798 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [INFO-LOG]
11:32:05,798 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
11:32:05,799 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:32:05,799 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1213710600 - setting totalSizeCap to 10 GB
11:32:05,799 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1213710600 - No compression will be used
11:32:05,799 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1213710600 - Will use the pattern /logs/node.name_IS_UNDEFINED/cus-pre-loan-%d{yyyy-MM-dd}.log for the active file
11:32:05,803 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern '/logs/node.name_IS_UNDEFINED/cus-pre-loan-%d{yyyy-MM-dd}.log'.
11:32:05,803 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
11:32:05,804 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to 2023-10-13T03:32:05.804Z
11:32:05,804 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1213710600 - Cleaning on start up
11:32:05,804 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[INFO-LOG] - Active log file name: /logs/node.name_IS_UNDEFINED/cus-pre-loan-2023-10-13.log
11:32:05,804 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[INFO-LOG] - File property is set to [null]
11:32:05,805 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
11:32:05,805 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
11:32:05,806 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [ERROR-LOG]
11:32:05,806 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
11:32:05,806 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:32:05,806 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1710203520 - setting totalSizeCap to 10 GB
11:32:05,806 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1710203520 - No compression will be used
11:32:05,806 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1710203520 - Will use the pattern /logs/node.name_IS_UNDEFINED/cus-pre-loan.error-%d{yyyy-MM-dd}.log for the active file
11:32:05,806 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern '/logs/node.name_IS_UNDEFINED/cus-pre-loan.error-%d{yyyy-MM-dd}.log'.
11:32:05,806 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
11:32:05,806 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to 2023-10-13T03:32:05.806Z
11:32:05,806 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1710203520 - Cleaning on start up
11:32:05,806 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ERROR-LOG] - Active log file name: /logs/node.name_IS_UNDEFINED/cus-pre-loan.error-2023-10-13.log
11:32:05,806 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ERROR-LOG] - File property is set to [null]
11:32:05,806 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
11:32:05,806 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
11:32:05,808 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [ASYNC-INFO]
11:32:05,808 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [INFO-LOG] to ch.qos.logback.classic.AsyncAppender[ASYNC-INFO]
11:32:05,809 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC-INFO] - Attaching appender named [INFO-LOG] to AsyncAppender.
11:32:05,809 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC-INFO] - Setting discardingThreshold to 0
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [ASYNC-ERROR]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ERROR-LOG] to ch.qos.logback.classic.AsyncAppender[ASYNC-ERROR]
11:32:05,809 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC-ERROR] - Attaching appender named [ERROR-LOG] to AsyncAppender.
11:32:05,809 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC-ERROR] - Setting discardingThreshold to 0
11:32:05,809 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [com.weshare.acc] to DEBUG
11:32:05,809 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@b9a7e5e - Propagating DEBUG level on Logger[com.weshare.acc] onto the JUL framework
11:32:05,809 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting additivity of logger [com.weshare.acc] to false
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [CONSOLE] to Logger[com.weshare.acc]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-INFO] to Logger[com.weshare.acc]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-ERROR] to Logger[com.weshare.acc]
11:32:05,809 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting level of logger [org.hibernate.SQL] to DEBUG
11:32:05,809 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@b9a7e5e - Propagating DEBUG level on Logger[org.hibernate.SQL] onto the JUL framework
11:32:05,809 |-INFO in ch.qos.logback.classic.model.processor.LoggerModelHandler - Setting additivity of logger [org.hibernate.SQL] to false
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [CONSOLE] to Logger[org.hibernate.SQL]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-INFO] to Logger[org.hibernate.SQL]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-ERROR] to Logger[org.hibernate.SQL]
11:32:05,809 |-INFO in ch.qos.logback.classic.model.processor.RootLoggerModelHandler - Setting level of ROOT logger to INFO
11:32:05,809 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@b9a7e5e - Propagating INFO level on Logger[ROOT] onto the JUL framework
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [CONSOLE] to Logger[ROOT]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-INFO] to Logger[ROOT]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [ASYNC-ERROR] to Logger[ROOT]
11:32:05,809 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@61928436 - End of configuration.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.9)

2023-10-13 11:32:05.827 INFO  [main] [line 51]: Starting AOT-processed CusPreLoanApplication using Java 21 with PID 6620 (C:\Users\Administrator\Desktop\temp\cus-pre-loan-app.exe started by Administrator in C:\Users\Administrator\Desktop\temp)
2023-10-13 11:32:05.829 INFO  [main] [line 638]: The following 1 profile is active: "dev"
2023-10-13 11:32:05.832 INFO  [main] [line 282]: BeanFactory id=7f84dc71-daeb-39b2-9ae4-fe1b11517571
2023-10-13 11:32:05.837 WARN  [main] [line 616]: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'enableEncryptablePropertySourcesPostProcessor': Unsatisfied dependency expressed through method 'enableEncryptablePropertySourcesPostProcessor' parameter 1: Error creating bean with name 'encryptablePropertySourceConverter': Instantiation of supplied bean failed
2023-10-13 11:32:05.839 ERROR [main] [line 822]: Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'enableEncryptablePropertySourcesPostProcessor': Unsatisfied dependency expressed through method 'enableEncryptablePropertySourcesPostProcessor' parameter 1: Error creating bean with name 'encryptablePropertySourceConverter': Instantiation of supplied bean failed
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:317)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:260)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:200)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:191)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:771)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:589)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:310)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293)
        at com.weshare.cus.preloan.CusPreLoanApplication.main(CusPreLoanApplication.java:15)
        at java.base@21/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptablePropertySourceConverter': Instantiation of supplied bean failed
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:888)
        at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:228)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:314)
        ... 22 common frames omitted
Caused by: java.lang.IllegalArgumentException: Invalid jasypt.encryptor.skip-property-sources: Class org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource not found
        at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySourceConverter.getPropertiesClass(EncryptablePropertySourceConverter.java:77)
        at java.base@21/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base@21/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
        at java.base@21/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base@21/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base@21/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base@21/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base@21/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySourceConverter.defaultSkipPropertySourceClasses(EncryptablePropertySourceConverter.java:59)
        at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySourceConverter.<init>(EncryptablePropertySourceConverter.java:53)
        at com.ulisesbocchio.jasyptspringboot.configuration.EncryptablePropertyResolverConfiguration.encryptablePropertySourceConverter(EncryptablePropertyResolverConfiguration.java:64)
        at com.ulisesbocchio.jasyptspringboot.configuration.EncryptablePropertyResolverConfiguration__BeanDefinitions.lambda$getEncryptablePropertySourceConverterInstanceSupplier$0(EncryptablePropertyResolverConfiguration__BeanDefinitions.java:40)
        at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68)
        at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:202)
        at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
        at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:214)
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:202)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214)
        ... 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:122)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:86)
        at java.base@21/java.lang.Class.forName(DynamicHub.java:1346)
        at java.base@21/java.lang.Class.forName(DynamicHub.java:1309)
        at java.base@21/java.lang.Class.forName(DynamicHub.java:1302)
        at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySourceConverter.getPropertiesClass(EncryptablePropertySourceConverter.java:71)
        ... 55 common frames omitted
paoyuan commented 1 year ago

See #246 & https://github.com/ulisesbocchio/jasypt-spring-boot/issues/246#issuecomment-1751957932