[ 
https://issues.apache.org/jira/browse/CAMEL-23480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18145494#comment-18145494
 ] 

Guillaume Nodet commented on CAMEL-23480:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Root cause identified: AbstractKeycloakTest declares a single static port 
(AvailablePortFinder.find()) shared across all subclasses in the same JVM. When 
OAuthCodeFlowServletTest and OAuthClientCredentialsServletTest run in the same 
fork, the second @BeforeAll gets BindException because the first class already 
holds the port. Additionally, Undertow server startup occurs before the 
Keycloak assumption check, so the test hard-fails instead of skipping cleanly. 
Fix is single-PR scope: give each test class its own port and move the Keycloak 
assumption into @BeforeAll.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> OAuthCodeFlowServletTest is failing (now skipped)
> -------------------------------------------------
>
>                 Key: CAMEL-23480
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23480
>             Project: Camel
>          Issue Type: Test
>    Affects Versions: 4.20.0
>            Reporter: Aurélien Pupier
>            Assignee: Guillaume Nodet
>            Priority: Major
>         Attachments: image-2026-10-09-09-45-01-695.png
>
>
> it has failed 12 times in a row on CI with JDK 21 (it is skipped with other 
> jdks)
> {noformat}
> java.lang.RuntimeException: java.net.BindException: Address already in use
>       at io.undertow.Undertow.start(Undertow.java:254)
>       at java.lang.RuntimeException: java.net.BindException: Address already 
> in use
>       at io.undertow.Undertow.start(Undertow.java:254)
>       at 
> org.apache.camel.test.oauth.OAuthCodeFlowServletTest.setUp(OAuthCodeFlowServletTest.java:46)
> Caused by: java.net.BindException: Address already in use
>       at java.base/sun.nio.ch.Net.bind0(Native Method)
>       at java.base/sun.nio.ch.Net.bind(Net.java:565)
>       at 
> java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:344)
>       at 
> java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:301)
>       at 
> java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
>       at 
> org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:178)
>       at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
>       at io.undertow.Undertow.start(Undertow.java:196)
>       ... 1 
> moreorg.apache.camel.test.oauth.OAuthCodeFlowServletTest.setUp(OAuthCodeFlowServletTest.java:46)
> Caused by: java.net.BindException: Address already in use
>       at java.base/sun.nio.ch.Net.bind0(Native Method)
>       at java.base/sun.nio.ch.Net.bind(Net.java:565)
>       at 
> java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:344)
>       at 
> java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:301)
>       at 
> java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
>       at 
> org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:178)
>       at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
>       at io.undertow.Undertow.start(Undertow.java:196)
>       ... 1 more
> {noformat}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to