'RabbitMQ JAVA Spring Configurations - spring.rabbitmq.ssl.key-store

I am trying to connect my Spring application to a RabbitMQ server. I have in my src/main/resources folder an application.properties file containing the following properties:

spring.rabbitmq.port=port
spring.rabbitmq.username=user
spring.rabbitmq.password=pass
spring.rabbitmq.host=hostname
spring.rabbitmq.ssl.verify-hostname=true
spring.rabbitmq.virtual-host=virtualHost
spring.rabbitmq.ssl.enabled=true
spring.rabbitmq.ssl.algorithm=TLSv1.2
spring.rabbitmq.ssl.key-store=client-file
spring.rabbitmq.ssl.key-store-password=client

The "client-file" is also in the same directory - src/main/resources. However, when I build the application - I recieve the following error:

Factory method 'rabbitConnectionFactory' threw exception; 
nested exception is org.springframework.amqp.AmqpIOException: java.io.FileNotFoundException: 
class path resource [client-file] cannot be opened because it does not exist

My file is not being recognized... I might need to have some full path, but am not sure what it should look like. Any help would be greatly appreciated!



Solution 1:[1]

Try like this:

...
spring.rabbitmq.ssl.key-store=classpath:/client-file
spring.rabbitmq.ssl.key-store-password=client

I did put mine in the resource folder '..\src\main\resources'.

Solution 2:[2]

use file:file_path if you are placing the file on a directory location(or a mounted drive) outside your app.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 Mayank Vaid