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 4080888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:59:18+00:00 2026-05-20T17:59:18+00:00

I am using tomcat as my webserver. i have application which needs a tomcat

  • 0

I am using tomcat as my webserver. i have application which needs a tomcat server restart after click of edit button by user. for that i have written a code on my controller as below:

if (updateResult ==1) 
{
   //String command = "/home/sunil_shiwankar/Tempo/apache-tomcat-6.0.32/startup.sh";//for linux use .sh
    String command = this.getClass().getResource("/").getPath();
    System.out.println("{{{{{{{{{{{{{{{{{{{{{{{{{{{"+ command);
    command = command.replace(command.substring(command.lastIndexOf("webapps"), command.length()), "");
    System.out.println("{{{{{{{{{{{{{{{{{{{{{{{{{{{ AFTER MODIFYING COMMAND IS "+ command);
    try
    {
      String shutDownCommand = command+"bin/shutdown.sh";
      Process child = Runtime.getRuntime().exec(shutDownCommand);
      System.out.println("{{{{{{{{{{{{{{{{{{{{{{{{{{{ SHUTDOWN TOMCAT SUCCESSFULLY }}}}}}}}}}}}}}");
    } catch (Exception e) 
    {
        String inExceptionStartCommand = command+"bin/startup.sh";
        Process child = Runtime.getRuntime().exec(inExceptionStartCommand);
        System.out.println("{{{{{{{{{{{{{{{{{{{{{{{{{{{ TOMCAT STARTED WITH EXCEPTION SUCCESSFULLY }}}}}}}}}}}}}}");
        e.printStackTrace();
    }
        String normalStartCommand = command+"bin/startup.sh"; 
        Process child = Runtime.getRuntime().exec(normalStartCommand);
        System.out.println("{{{{{{{{{{{{{{{{{{{{{{{{{{{ TOMCAT STARTED WITOUT EXCEPTION SUCCESSFULLY }}}}}}}}}}}}}}");
}

my tomcat version 6.0.32 and while runing my application it shutdown tomcat server proparly and starts with an exception

java.net.BindException: Address already in use <null>:8080
    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)
    at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1022)
    at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)
    at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    at java.net.ServerSocket.<init>(ServerSocket.java:185)
    at java.net.ServerSocket.<init>(ServerSocket.java:141)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
    ... 12 more
16 Mar, 2011 10:17:43 AM org.apache.catalina.core.StandardService initialize
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]]
LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use <null>:8080
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1024)
    at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)
    at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

please help me to resolve

Thank in advance

  • 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-20T17:59:19+00:00Added an answer on May 20, 2026 at 5:59 pm

    That code, although hard to read, appears to not be waiting for the shutdown to happen. I suspect it’s still in the process of shutting down when you try to start it again. Certainly, the exception indicates it’s still running, because its http port is still in use. To track the problem down temporarily, try putting a sleep in between the shutdown and startup to see if it fixes the problem.

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

Sidebar

Related Questions

I am using Tomcat 6.0 Application server and Apache HTTP webserver 2.2 and Eclipse
i am using tomcat server and i have added a rhino engine to able
I am new in using Tomcat Server. In one of the my web application
My Tomcat needs to connect to another web server (at https://foreign.example.com ) using SSL
I have web services written using java which interacts with the android application only
hi i am using tomcat 6 as webserver. i have two webbapplication installed on
I am using spring,JPA,jsf for my application and webserver is tomcat.In my application i
I have a Django app we're attempting to deploy to a Tomcat server, using
I have developed web application which uses JasperReports for reporting purpose. In that I
I have a jsp servlet application. I am using tomcat5.5 as web server and

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.