spring-cloud / spring-cloud-stream

Framework for building Event-Driven Microservices
http://cloud.spring.io/spring-cloud-stream
Apache License 2.0
1.01k stars 614 forks source link

Fixing empty truststore-config in Kafka Streams binder #2913

Closed babubabu closed 8 months ago

babubabu commented 8 months ago

The Config worked until version 4.0.4 :-)

Error was: Caused by: java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [${TRUSTSTORE_PATH}] cannot be opened because it does not exist at org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties.moveCertsToFileSystemIfNecessary(KafkaBinderConfigurationProperties.java:199) at org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties.getKafkaConnectionString(KafkaBinderConfigurationProperties.java:183) at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.normalalizeBootPropsWithBinder(KafkaTopicProvisioner.java:300) at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.(KafkaTopicProvisioner.java:140) at org.springframework.cloud.stream.binder.kafka.config.KafkaBinderConfiguration.provisioningProvider(KafkaBinderConfiguration.java:118) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ... 161 more Caused by: java.io.FileNotFoundException: class path resource [${TRUSTSTORE_PATH}] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211) at org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties.moveCertToFileSystem(KafkaBinderConfigurationProperties.java:243) at org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties.moveCertsIfApplicable(KafkaBinderConfigurationProperties.java:208) at org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties.moveCertsToFileSystemIfNecessary(KafkaBinderConfigurationProperties.java:191)

sobychacko commented 8 months ago

Could you add your name as an @author to the classes you modify and update any copyright years? Thanks!

babubabu commented 8 months ago

@sobychacko : Done! Thanks for review the copyright was right, already. I squahed the two commits

sobychacko commented 8 months ago

Thanks for the PR. It is now merged upstream to main and back-ported to 4.0.x.

babubabu commented 8 months ago

Thank you