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.

Default port or not?

See original GitHub issue

Javalin has used port 7000 since v1 in case no port is specified. I recently changed this to port 0, which means Javalin will start on a random available port in case you don’t specify a port explicitly.

Javalin.create().start(); // before, this would start on port 7000

Any thoughts on this change?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
pkkummermocommented, Jun 15, 2021

Randomness is weird, I’d rather have a default port. Default ports has a tendency to be remembered in browsers when debugging as well 😃

1reaction
tipsycommented, Jun 17, 2021

I searched for javalin start on GitHub and have looked through about a hundred of the projects at random. I didn’t find a single one that calls start() without a port specified, unless it was using a custom Server.

(There are some projects that call start() without a port, but they use an older version of Javalin where you had to call port(port).start())

I could of course have gotten lucky with my samples, but I’m starting to think this won’t be a very dramatic change. A lot of projects changed it to 8080 too.

What do you think of making the start function fun start(port: Int?). Just don’t have a default. Have both null and 0 bind to a random port.

I would really liket that, but we have to support the case where you’re starting a Server that has its own custom connectors. It could be possible to change server from being a config option to being an overload on start, so you have

start(port)
start(port, host)
start(server)

But that comes with its own set of challenges (we need to be careful to not introduce a hard dependency on Jetty).

Read more comments on GitHub >

github_iconTop Results From Across the Web

List of TCP and UDP port numbers - Wikipedia
Port TCP UDP 1024 Reserved Reserved 1025 Yes Yes 1027 Reserved
Read more >
What are port numbers and how do they work? - TechTarget
Port number 8080 is usually used for web servers. When a port number is added to the end of the domain name, it...
Read more >
Understanding Default Open Ports - Aruba Networks
Port Number Protocol Where Used 17 TCP controller 21 TCP controller 22 TCP controller
Read more >
Does changing default port number actually increase security?
In my opinion moving the port that an application runs on does not increase security at all - simply for the reason ...
Read more >
Running SQL Server 'Default' instance on a non-default (or ...
We know that with the default setup of SQL Server (SQL Server 2000/2005/2008), the 'Default' instance listens on TCP port 1433. But we...
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