Reputation: 119
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?????
Upvotes: 11
Views: 141307
Reputation: 1
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
Upvotes: 0
Reputation: 91
Upvotes: 0
Reputation: 23
Try to delete .m2 file in This pc-> C drive-> users -> .m2 then restart eclipse and run the server again
Upvotes: 0
Reputation: 21
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)
Hope it helps you Cheers
Upvotes: 2
Reputation: 21
Also Verify the Argument should contains "-Dspring.profiles.active="enviroment name"
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 59
It will work.
Upvotes: 5
Reputation: 1
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
Upvotes: 0
Reputation: 1
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"/>
Upvotes: 0
Reputation: 139
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.
Upvotes: 0
Reputation: 11
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>
Upvotes: 0
Reputation: 1
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.
Upvotes: -2
Reputation: 9
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.
Upvotes: 0
Reputation: 11
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.
Upvotes: 1
Reputation: 1
Open the 'server.xml' file. picture1
Press ctrl + f and find the 'shutdown' word. Then change the port number. picture2
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.
Upvotes: 0
Reputation: 21
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.
Upvotes: 2
Reputation: 1
I uninstalled tomcat server, deleted the server from eclipse and reinstalled, reattached tomcat. It's running fine now.
Upvotes: 0
Reputation: 1
<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.
Upvotes: 0
Reputation: 61
Have you tried to put /
in the webServlet above your class?
@WebServlet("/nameURL")
public class MyClass extends HttpServlet{}
Upvotes: 1
Reputation: 3
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.
Upvotes: 0
Reputation: 441
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
Upvotes: 0
Reputation: 13
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;
Upvotes: 0
Reputation: 1618
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.
Upvotes: 2