8000 Facing com.tngtech.keycloakmock.api.MockServerException after upgrading to spring boot 3.5.9 · keycloak keycloak · Discussion #45500 · GitHub
[go: up one dir, main page]

Skip to content
Discussion options

You must be logged in to vote

This is a port binding issue - the KeycloakMock is trying to use a port that is already occupied. After upgrading Spring Boot, the test lifecycle timing changed.

Try this:

  1. Use a random port instead of fixed:
KeycloakMock keycloakMock = new KeycloakMock(0); // 0 = random available port
  1. Or explicitly stop any previous instance in beforeAll:
@BeforeAll
static void beforeAll() {
    if (keycloakMock != null) {
        keycloakMock.stop();
    }
    keycloakMock = new KeycloakMock(8080);
    keycloakMock.start();
}
  1. Check if another test class is running in parallel and binding the same port. Add to your test:
@Isolated // JUnit 5 - prevents parallel execution

The root cause is likely Spr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bd-smpatil
Comment options

Answer selected by bd-smpatil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
0