Payara5 - Address already in use

Hi all,

I am trying to set-up Payara5 to listen to the port 8081 with the config: configs.config.server-config.network-config.network-listeners.network-listener.http-listener-2.port=8081

During deployment, I receive the following error:
ul 19, 2024 8:56:00 AM com.sun.enterprise.v3.server.AppServerStartup postStartupJob
INFO: Payara Server 5.2022.5 #badassfish (492) startup time : Felix (4,715ms), startup services(17,109ms), total(21,824ms)
FileMonitoring shutdown
Jul 19, 2024 8:56:00 AM com.sun.enterprise.v3.server.AppServerStartup postStartupJob
SEVERE: Shutting down server due to startup exception
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:459)
at java.base/sun.nio.ch.Net.bind(Net.java:448)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:107)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:64)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:215)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:204)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:53)
at org.glassfish.grizzly.config.GenericGrizzlyListener.bindTransport(GenericGrizzlyListener.java:211)
at org.glassfish.grizzly.config.GenericGrizzlyListener.configure(GenericGrizzlyListener.java:339)
at com.sun.enterprise.v3.services.impl.GrizzlyProxy.initialize(GrizzlyProxy.java:126)
at com.sun.enterprise.v3.services.impl.GrizzlyService.createNetworkProxy(GrizzlyService.java:673)
at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:595)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

Jul 19, 2024 8:56:00 AM com.sun.enterprise.v3.server.AppServerStartup doStart
SEVERE: Failed to start, exiting

The payara server is inside a Docker container and has an unique IP, thus the port is not used by another application/instance. If I choose another port, then the deployment works fine.

I do not want to use another port since I will have to change the configuration (Kubernetes config - Ingress and SVC, as well as liveness/readiness probes, monitoring etc) to a new port, which is a lot of work. How can I set up Payara to listen to 8081 (HTTPS) without having any interference?

Thanks a lot and I am waiting for your reply.

If it says, that the port is occupied, it very probably is. Is it possible, that there is any other listener configured to the same port?
What docker image do you use?