I have a system which consists of two parts: a Spring Boot application and a JAX-RS application. They exchange data using JSON. The connection between them has to be implemented via HTTPS. This way I work with keytool to generate a self-signed certificate and set the connection between these two parts. Now they are available from the browser but cannot get a connection between each other.
JAX-RS service is deployed on a JBoss (WildFly) 24.0.0 web-server.
The keystore was generated with the following command:
keytool -genkey -alias localhost -keyalg RSA -keystore keystore.jks -keysize 4096
The command was run in $JBOSS_HOME\standalone\configuration directory. Then I copied this keystore to ...\src\main\resources folder of Spring Boot project. In application.properties I wrote the following list of configuration:
server.ssl.enabled=true
server.ssl.key-store-type=JKS
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-password=keystore_password
server.ssl.key-alias=localhost
server.ssl.protocol=TLS
After this configuration both systems are available from the browser but cannot get a connection between each other with Unable to invoke request: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target error (JAX-RS side). I also tried to add the truststore configuration to the application.properties file but Spring Boot started to fail on startup:
server.ssl.trust-store=classpath:keystore.jks
server.ssl.trust-store-password=keystore_password
What are my next steps to make the two parts connect properly? Where do I import the keystore? Can I create a truststore file myself for both Spring Boot service and JAX-RS service?