Closed tobiasake closed 2 years ago
It could also be that when it don't find the Jasypt file it fails then it skip reading the provided config and do fall back to the default application.config , since it start to use the defaullt rabbitmq/amqp addresses and port, and it fails to start since there is no RabbitMq instance available on the this default config: 29-11-2021 12:27:17.068 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - RabbitMqProperties init ... 29-11-2021 12:27:17.069 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - Host address: 127.0.0.1 29-11-2021 12:27:17.070 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - Port is: 5672 29-11-2021 12:27:17.075 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - Using default virtual host 29-11-2021 12:27:17.075 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - Exchange is: amq.direct 29-11-2021 12:27:17.075 [main] INFO c.e.e.r.publish.helper.RMQHelper.init - Using standard connection method to RabbitMQ. 29-11-2021 12:27:17.076 [main] INFO c.e.e.r.publish.helper.RMQHelper.hasExchange - Exchange is: amq.direct 29-11-2021 12:27:17.108 [main] ERROR o.s.boot.SpringApplication.reportFailure - Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'producerController': Unsatisfied dependency expressed through field 'messageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageServiceRMQImpl': Unsatisfied dependency expressed through field 'rmqHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rmqHelper': Invocation of init method failed; nested exception is com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException: Exception occurred while creating Rabbitmq connection ::127.0.0.15672Connection refused (Connection refused) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) at org.springframework.beans.factory.annotation
After some testing with my new PR I found out that I used wrong config path due to I use different Docker base image. Java execution working directory was changed to different directory and due to that it didn't find the application.propertis. Fixing the config path in the Docker images solves problably the issue in the current/old remrem versions as well, but this PR change and issue ticket improves the initiations of the configuration and removes the errors and execeptions that is thrown at startup of RemRem-Publish without Jasyp config.
Description
I made an upgrade of RemRem-Publish from version 2.0.17 to 2.0.20 and now it fails to start due to RemRem application can't find Jasyp file path. The Jasyp File path config should be optional and should be force asked and now it seems to be mandatory. Jasypt configurations should be optional and should only print errors and fails start if when the Jasypt config has been provided and faulty configured.
Current RemRem-Publish fails to start even if the Jasypt config is provided with empty string and if Jasypt config is provided.
Some error log: 29-11-2021 12:27:17.039 [main] ERROR c.e.e.r.p.c.RabbitMqPropertiesConfig.readJasyptKeyFile - Could not read the jasypt key from the jasypt key file path: <The location of the key which was used to encrypt the password, used for decryption of the Encrypted passwords in application > (No such file or directory) java.io.FileNotFoundException: <The location of the key which was used to encrypt the password, used for decryption of the Encrypted passwords in application > (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
Motivation
RemRem-Publish need to be able to start without Jasypt config. Jasypt config should be optional and RemRem-Publish should not give error and Exit non-zero if config is not provided.
Exemplification
Benefits
A fully functional RemRem-Publish that starts without any issues.
Possible Drawbacks
No