question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't bind to port - always reports it's 7000

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
IvanPizhenkocommented, Aug 22, 2021

Thank you @tipsy !

1reaction
tipsycommented, Aug 21, 2021

Should be out now @IvanPizhenko !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Control Center on Monterey listening on ports?
Port 7000 was open and bound to ControlCenter. The traffic I've captured (PCAP) respembles the airplay protocol RTSP. using a blist00 tag followed...
Read more >
Failed to bind to address https://127.0.0.1:5001 ... - GitHub
Trying to run a freshly created project I get the following. Seems like a race condition because port 5001 is not in use...
Read more >
HAProxy Network Error: cannot bind socket - DigitalOcean
An HAProxy cannot bind socket error message is generated when there is another process listening on the same interface and TCP port combination ......
Read more >
Cannot bind to port, even though tcpview says it's not in use
The usual solution for me is to fire up tcpview (from sysinternals), see what's using that port, killing that process, then trying again....
Read more >
Node.js Port 3000 already in use but it actually isn't?
I started having this issue after a Windows update. Never thought about turning WiFi off.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found