Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7614591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:26:32+00:00 2026-05-31T02:26:32+00:00

Currently we have a Jetty 7 server started this way //create a new server

  • 0

Currently we have a Jetty 7 server started this way

//create a new server listening on the 80
Server server = new Server();

SelectChannelConnector connector = new SelectChannelConnector();
connector.setReuseAddress(false);
connector.setPort(80);
server.setConnectors(new Connector[]{connector});

...
server.start();

And when there’s no other application catching the 80 port, all is fine. I’ve also ensured that two Instances of Jetty can’t start listening on the same port because of the setReuseAddress.

There is however a case when some other application starts listening on port 80 and Jetty server still manages to start (failing to serve connections there).

C:\Users\bacadmin>netstat -anov | find ":80 "

TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       3976
TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       3808
TCP    [::]:80                [::]:0                 LISTENING       3976

How is that possible and what can be done to insure that Jetty gets an exception during startup if the port isn’t open.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:26:34+00:00Added an answer on May 31, 2026 at 2:26 am

    Jetty throws exception if the port is already in use. Are you catching all exceptions and suppressing it somewhere?

    Regarding reserving a port: This is not really possible. If you keep running your jetty application all the time and use 80, then that kind of reserved it for you…

    (added code to help in identifying the root cause)

    import org.eclipse.jetty.server.Server;
    import org.eclipse.jetty.server.Connector;
    import org.eclipse.jetty.server.nio.SelectChannelConnector;
    
    public class Main {
        public static void main(String[] args) {
    
            Server server = new Server();
    
            SelectChannelConnector connector = new SelectChannelConnector();
            connector.setReuseAddress(false);
            connector.setPort(80);
            server.setConnectors(new Connector[]{connector});
    
            try {
                server.start();
            } catch (Exception e) {
                e.printStackTrace(); 
            }
    
        }
    }
    

    In my environment, this definitely get java.net.BindException: Address already in use: bind

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
Currently have this: foreach (var series in Chart1.Series) { series.Enabled = false; } I
We currently have a company email server with Exchange, and a bulk email processing
I currently have a fairly robust server-side validation system in place, but I'm looking
I currently have heavily multi-threaded server application, and I'm shopping around for a good
I currently have a class and I'm trying to create an easy GUI to
I have installed Apache Axis2 1.6.1 in a Jetty 8.0.4 web server, but JSON
i'm working on a project where i have an embedded jetty server for serving
I'm currently using Jetty as my websocket server and I'm trying to make a
Currently have : LOAD DATA LOCAL INFILE '/Users/RkG/Desktop/Microblogs.csv' INTO TABLE blogs This is an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.