Can be reproduce via https://github.com/nhmarujo/jks-native.
Comment From: nhmarujo
Hi @sdeleuze. Did you manage to make my sample app to run with just your changes? I tried the app pointing to 6.0.10-SNAPSHOT
and I got this at first:
21:26:44.825 [main] ERROR org.springframework.boot.SpringApplication -- Application run failed
java.lang.NullPointerException: null
at org.springframework.cloud.context.encrypt.EncryptorFactory.create(EncryptorFactory.java:55)
at org.springframework.cloud.bootstrap.encrypt.TextEncryptorUtils.getTextEncryptor(TextEncryptorUtils.java:66)
at org.springframework.cloud.bootstrap.encrypt.TextEncryptorUtils.decrypt(TextEncryptorUtils.java:51)
at org.springframework.cloud.bootstrap.encrypt.DecryptEnvironmentPostProcessor.postProcessEnvironment(DecryptEnvironmentPostProcessor.java:66)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:109)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:94)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64)
at java.base@17.0.6/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:355)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294)
at com.sample.jksnative.JksNativeApplication.main(JksNativeApplication.java:16)
I did some analysis and had to add this hint to make it work for me:
hints.reflection().registerTypeIfPresent(classLoader, "org.springframework.security.rsa.crypto.RsaSecretEncryptor", INVOKE_DECLARED_CONSTRUCTORS);
Is that supposed? Or did you manage to make it run without this?
Thank you in advance
Comment From: sdeleuze
The change I pushed indeed "just" fixed the issue you reported initially and I had the same next error than you, likely due to missing hints related in TextEncryptorUtils
.
I recommend reporting it in https://github.com/spring-cloud/spring-cloud-commons/issues.
Comment From: nhmarujo
Thank you @sdeleuze. Will do.