Description
When using both spring-boot-starter-remote-shell
and spring-security-jwt
there is a version conflict concerning org.bouncycastle:bcpkix-jdk15on
.
Simple steps to replicate the issue:
- Open Spring Initializr
- Use spring-boot 1.2.5.RELEASE, choose Remote Shell and download/open the project
- Manually add
spring-security-jwt
as dependency
The POM should have the following dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
</dependency>
spring-boot-starter-remote-shell
(1.2.5.RELEASE) needs org.bouncycastle:bcpkix-jdk15on
(1.51), but having spring-security-jwt
(1.0.3.RELEASE) as dependency leads to version 1.47 to be used.
This will cause errors when using the remote shell as the API of the bouncycastle library has changed considerably between 1.47 and 1.51. More precisely, it causes an exception when someone tries to connect to the remote shell: java.lang.IllegalStateException: Unable to negotiate key exchange for server host key algorithms
.
However, the real issue is an InvocationTargetException
which is thrown while trying to read the server key due to the incompatible API.