11

I am using Eclipse Neon and Tomcat server 9.0 and JDK 1.8 It was working well but unfortunately its giving me error 'Server Tomcat v9.0 Server at localhost failed to start.' I tried to change the ports i.e. connection port and other ports too but it did not solve my problem and this error is shown when I start the server or run the web app I am currently working on. Other solution other than change in port because I tried it and it did not resolve my problem?????

3
  • 6
    Could you please post the logs / output from the eclipse concole? Commented Jan 26, 2017 at 14:27
  • anyone figured this? Commented Mar 6, 2017 at 5:58
  • 1. Check Runtime Environment JRE is mapped, if two JRE's exist select preferred one. 2. If you Configured a new Apache server you need to Restart Eclipse IDE once. Commented Sep 12, 2022 at 9:19

23 Answers 23

5
  1. Delete server by navigating to Window ->Show View -> Server. Right click on server and delete it.
  2. Delete Servers folder from Project Explorer
  3. Delete .metadata of eclipse workspace (CAUTION: You will lose all your workspace settings (e.g.: key bindings, appearance, ...))
  4. Now Restart eclipse and add Apache Tomcat server.

It will work.

Screenshot

Sign up to request clarification or add additional context in comments.

2 Comments

For me, only the first step was enough.
Maybe a bit too late, but it doesn't work for me.
3

I had the same problem, which was solved when I changed the admin port (right-click on the server inside eclipse and select properties) from a hyphen(default) to another port number. I used another port number for the admin port (not the same as the port number I used for my tomcat)

enter image description here

enter image description here

Hope it helps you Cheers

Comments

2

I had the same problem with Tomcat 9.xx and Eclipse. None of the given solutions helped me.

However, there is a missing step (for some of us) before recreating a new Server in Eclipse you may need to add the path to a jar file. The missing step was browsing to your /Tomcat-Directory/lib/servlet-api and adding servlet-api.jar

Steps:

1- Right click on the project you work on > Build Path > Configure Build Path > Libraries > Add External JARs

2- Select all JAR files from the Tomcat/bin and Tomcat/lib

3- Click "OK"

This made it work for me. I hope it will help you as well.

Thank you.

Comments

2

I was facing a similar problem in my spring MVC project. The problem was in the web.xml file. So in Spring 5 before you configure your dispatcher servlet you have to use the tag

<absolute-ordering></absolute-ordering>

Worked fine for me. Happy Coding.

Comments

1

Have you tried to put / in the webServlet above your class?

@WebServlet("/nameURL") public class MyClass extends HttpServlet{} 

Comments

1

In my case, I had messed up up with my JAR files. My JAR files were corrupted. So delete existing JAR files and upload new JAR files. Hope this works. *Check 'Markers' tab for errors and warnings.

1 Comment

This can be a really good comment and not an answer.
0

If you can't detect which project creates the problem then simply add and remove it in your server and run. If defective project is not anymore added to the server then server will run correctly. After detecting the problem you can simply follow the steps below.

If you are using data base connection with connection pooling then make sure @Resource(name="jdbc/dbName") is written before private DataSource dataSource in your servlet controller class. Just put it like this in your servlet controller class:

@Resource(name="jdbc/sakila") private DataSource dataSource; 

Comments

0

Right click on the project you work on > Build Path > Configure Build Path > Libraries > Add External JARs--servlet-api.jar and jsp-api.jar if you are deploying web Application

Comments

0

There was once I had messed around the server.xml file, and unwittingly added a Context tag telling the server to load a project I wasn't looking to load, and therefore had not compiled. That threw the Server Tomcat v9.0 Server at localhost failed to start, which went away after I deleted that.

Comments

0
  1. Go to directory (your workspace).metadata.plugins\org.eclipse.wst.server.core\tmp0\conf
  2. Open server.xml file on editor
  3. Delete <Context docBase="(your workspace)\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\(your old project)" path="/(your old project)" reloadable="true" source="org.eclipse.jst.jee.server:(your old project)"/>

there might be some left over from your old project. so, only delete projects that have not been used or that were previously deleted. because if you delete one line then your server will be able to run but not with your project. because some of your project lines were deleted too.

Comments

0

I uninstalled tomcat server, deleted the server from eclipse and reinstalled, reattached tomcat. It's running fine now.

Comments

0
  1. Open the 'server.xml' file. picture1

  2. Press ctrl + f and find the 'shutdown' word. Then change the port number. picture2

  3. done. Because when the connection port number and shutdown port number are the same, then it creates conflict. So, one port number we should change.

Comments

0

This happens because your server HTTP port and your shutdown port are the same.

To resolve this, go to the server.xml file and search. There will be a SHUTDOWN port entry. Change it and your server will work.

Comments

0

There is a possibility that you are missing a "/" in your web.xml file probably in: <servlet-mapping></servlet-mapping>

<url-pattern> missing "/" before pattern name </url-pattern>

possible issue

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

If you are using Spring Framework, please check in the WEB.XML Dispatcher Servlet is configured correctly. Also check if there is any spelling/name incorrectness.

Comments

0

Change your redirect port in server.xml to something else and it should work

 <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8900"/> 

Comments

0

Just check your Console. Than search for relevant solution i did everthing, but ended up deleting a mapping error shown in console from web.xml

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

https://www.youtube.com/watch?v=SEO22ifq9qE&ab_channel=%23VhCode

Delete web.xml under WEB-INF of the selected project or correct everything in that file, then try restarting the server.

Comments

0

Also Verify the Argument should contains "-Dspring.profiles.active="enviroment name"

Comments

0

Try to delete .m2 file in This pc-> C drive-> users -> .m2 then restart eclipse and run the server again

Comments

0
  1. Go to "Window" menu and select "Preferences".
  2. In the Preferences window, expand the "Java" section and select Installed JREs". Here, you should see a list of JREs that are currently installed on your system. Check if the JRE you are looking for is listed, or you can add it by clicking on the "Add" button and providing the path to the JRE installation directory.

Comments

0

If you have latest version of eclipse, the problem is with XML file. You need to use Annotations instead of XML file.

@WebServlet("url") ->Use this after imports

Comments

-2

This is the best solution. It worked for me.

Steps:-

1- Open the Servers tab from Windows » Show View » Servers menu.

2- Right click on the server and delete it

3-Create a new server by going New » Server on server tab.

4-Click on Configure runtime environments link.

5-Select the Apache Tomcat Server and remove it. This will remove the Tomcat server configuration.

6-Click on OK and exit the screen above now.

7-From the screen below, choose Apache Tomcat server and click on Next button:

8-Browse to Tomcat Installation Directory.

9-Click on Next and choose which project you would like to deploy:

10-Click on Finish after adding your project.

11-Now launch your Server.

1 Comment

This is not working. You need to set admin port to any available port. example if your tomcat is installed on port 8080 then double click on tomcat server and then set port 9999 in tomcat admin port instead of - . This worked for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.