javalin: Can't bind to port - always reports it's 7000
Actual behavior (the bug) When Javalin (Jetty) tries to bind to a port that’s in use, it will always complain that it’s port 7000 whatever port it’s binding to.
Expected behavior If it’s trying to bind to port 443, then the error message should say that.
To Reproduce Start up 2 Javalin server on the same port.
Additional context Example stack trace (notice the IOException part):
java.lang.RuntimeException: Port already in use. Make sure no other process is using port 7000 and try again.
at io.javalin.Javalin.start(Javalin.java:185)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436)
at XxxMainKt.main(XxxMain.kt:65)
Caused by: java.io.IOException: Failed to bind to xxx.yyy.com/45.77.52.9:443
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at io.javalin.core.JavalinServer.start(JavalinServer.kt:63)
at io.javalin.Javalin.start(Javalin.java:175)
... 10 more
Caused by: java.net.SocketException: Permission denied
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:455)
at java.base/sun.nio.ch.Net.bind(Net.java:447)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
... 18 more
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- Backport fix for the issue #1270 to v3.x (#1357) Co-authored-by: Ivan Pizhenko <IvanPizhenko@noreply.users.github.com> — committed to javalin/javalin by IvanPizhenko 3 years ago
Thank you @tipsy !
Should be out now @IvanPizhenko !
Thanks, I’ll release it now.
I would love to submit a fix @tipsy