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

Add missing hint for ResourceEditor #30628

Closed
sdeleuze opened this issue Jun 9, 2023 · 3 comments
Closed

Add missing hint for ResourceEditor #30628

sdeleuze opened this issue Jun 9, 2023 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Jun 9, 2023

Can be reproduce via https://github.com/nhmarujo/jks-native.

@sdeleuze sdeleuze added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Jun 9, 2023
@sdeleuze sdeleuze added this to the 6.0.10 milestone Jun 9, 2023
@sdeleuze sdeleuze self-assigned this Jun 9, 2023
@nhmarujo
Copy link

nhmarujo commented Jun 9, 2023

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

@sdeleuze
Copy link
Contributor Author

sdeleuze commented Jun 12, 2023

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.

@nhmarujo
Copy link

Thank you @sdeleuze. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants