[eclipse] "Server Tomcat v7.0 Server at localhost failed to start" without stack trace while it works in terminal

So got this project which worked just fine before the weekend (have other problems, but at least Tomcat launched). Now when I try to launch the Tomcat server it immediately gives the following error:

Server Tomcat v7.0 Server at localhost failed to start.

However, I can start Tomcat just fine via Terminal, and this problem is occurring in Eclipse (Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1 Build id: 20121004-1855)

I scoured several forums trying to find a solution but to no avail! Please help someone out in need.

This question is related to eclipse tomcat

The answer is


  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 v7.0 server and remove it. This will remove the Tomcat server configuration. This is where many people do mistake – they remove the server but do not remove the Runtime environment.

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

  7. From the screen below, choose Apache Tomcat v7.0 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. This will fix your Server timeout or any issues with old server configuration. This solution can also be used to fix “port update not being taking place” issues.


None of the answers mentioned above worked for me. I am using Tomcat 9 in my Eclipse IDE. Hence I tried the following steps on my Eclipse Neon.

Step #1: Click on Servers tab to see your server. In my case, it looks like the following:

enter image description here

Step #2: Right click on the server, select Properties, you will see the following window. Click on Switch Location, it will change the location to the one shown in the image below from the default one.Click on Apply and then OK to close the window.

enter image description here

Step #3 Double click on the Tomcat Server which will open the Overview option as shown in the image below. The Server Locations part was active for me when I did (it's shown inactive in the image because I already did that at my end and I have my server running) that and I selected the second radio button option which is Use Tomcat installation (takes control of Tomcat installation). I then closed this option , saved the changes when prompted and started my server. It started working fine.

enter image description here


To resolve this issue you have to delete tmp folder in the following directory

<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core

If there is any problem on deleting this folder then restart your eclipse then again delete that folder.


enter image description here

Consider cleaning your poject before running the servelet. This will delete all the corrupted files.


Try to delete the existing tomcat server in the server console ,if you don't have the console then you can go to "Show view ->server" then delete the server by right clicking on it. Add new server this will surely help you.


Creating a new workspace can also resolve this issue..


Everything was working fine one second and then my server started giving me this error. I went through all the answers mentioned here and what worked for me was this simple solution:

Deleting the server and then configuring a new one

If you're sure that you didn't change anything and the error just popped up, DO NOT start deleting .snap files or other temp files. Doing that will only cause more problems. And if the error occurred because of some changes made by you, this error is definitely going to be because of some errors in web.xml file.

P.S. Changing the workspace will do you absolutely no good, because if the problem is in your project, then it'll still occur in the new work space when you'll import the project!


Server Tomcat v7.0 Server at localhost failed to start.

This error resolve following three case

1.Clean project & server

Or

2.Remove .snap file from this directory

<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources

Or

3.Remove temp file from this directory

<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core

In my case, the problem was in the xml code somehow.

My web.xml file looked like this:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
    <display-name>Archetype Created Web Application</display-name>

    <servlet>
        <servlet-name>index</servlet-name>
        <jsp-file>index.jsp</jsp-file>
    </servlet>

    <servlet-mapping>
        <servlet-name>index</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>

but I changed it to look like

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
    <display-name>Archetype Created Web Application</display-name>

</web-app>

and now the server loads up properly. Strange.


I was facing similar problem this weekend. Tried all the above mentioned tricks, but none of them worked of me. (Working in Eclipse LUNA)

Then i analysed that just before creating a particular servlet, i was running Apache Tomcat v7.0 successfully. Which was "RefreshServlet" as shown below :

RefreshServlet.java

So that practicing servlets to understand the "AutoRefresh" functioning. When i remove this servlet from my application, it works fine, but when i try to add and run this servlet, it gives the same error "Apache Tomcat v7.0 failed to start"

Don't know why, but only removing this servlet works fine for me to run the rest of my application.

So, the bottom line suggestion from me would be that if not any other trick is working, then try removing any latest servlet or any class you just created before getting this error and it may work fine for you too for the rest of the application.

Any further explanation would be appreciated. Thanks


1st check in your Web.xml that there are multiple < servlet mapping > tags with different names If so Delete the unwanted ones and Run.. This should work fine

OR

To resolve this issue, you have to delete the .snap file located in the directory .

Goto your Workspace of Eclipse which you are UsingPath --> workspace.metadata.plugins\org.eclipse.core.resources\snapfile

Delete the snap file.

After deleting this file, Delete the Tomcat Server Then also Delete the Server runtime which is selected as Apache tomcat. Then Add Server again and Goto Project-->Properties-->Project Facets-->Right side you will find Details and Runtimes Tabs. Click Runtimes and Check the box of Apache which is already there(If not exist add it)

Change port numbers and Run it.


You can right click on apache-tomcat, choose properties, click Restore Default.


After trying all above mentioned steps , issue was not resolved.

Finally it resolved with below steps.

1- Check .log file inside your work space directory. Issue with Java Version

"Caused by: java.io.IOException: Cannot run program "C:\jdk1.7.0_45\bin\java": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:869) ... 80 more

Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source)"

I have installed correct OS compatible JDK and issue was resolved. PS: I have explicitly set JDK path through eclipse (Window->preference->installed JRE )but after setting correct JDK path ,it work fine for me.


In my case, removing servlet tags from web.xml and adding missing libraries in tomcat lib folder solved the issue.


The problem could be annotations in your servlet(s), see if you are using annotations for URL patterns for your servlets.

Try to change the project facet (Dynamic web project ) version to 2.5 and define all your servlet entries in web.xml this should solve the issue.

you can change project facet version in eclipse by changing it in project properties-->search for "facet" in the search box change the Dynamic web project facet version to 2.5


In my eclipse workspace, it was resolved by doing the below steps. Window --> Preferences --> Network Connections --> Change 'Active Provider' to 'Direct', instead of 'Native'. You may try it.


In my case, the problem was in the web.xml file, where i forgot to precede the url-pattern with a "/" (e.g. /login.do).

What solved my problem was, as mentioned above by @Ajak6, by adding the servlet API as an external JAR library for the project.

However, I found a better way, by adding Tomcat to the target runtime as follow;

1) project > properties

2) on the side menu select "Targeted runtimes"

3) select Tomcat (click apply)

4) click ok


Check your web descriptor (web.xml) or on your servlets (Where you annotate, check sor something like '@WebServlet("/servlet_name")') for any duplicates.If any, remove them.


I fixed this problem by right clicking on tomcat server in Server tab and click "Clean Tomcat Work Directory"


In my case the problem was caused by a syntax error in the arguments being passed. I had a space between the key & value when using '-D'

i.e.

-DMyArg= MyValue

instead of

-DMyArg=MyValue

I had the same problem in my tomcat server but when i check deeply i found that i add a new tag in my web.xml file and the server doesn't accept it so check your file to if any update happened then restart your tomcat and will be good .


open your web.xml file. (if you don't know where is it, then just google it.) it is like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
.
.
.
.
</web-app>

just below the <?xml version="1.0" encoding="UTF-8"?> line, add a tag <element> and close it in the very bottom with </element> tag. Done.


I solved my problem by closing all other projects in eclipse simply.


try removing all your project's dependencies from maven local repository(.m2).

Path : C:\Users\user_name\.m2\repository

close eclipse and open again it'll automatically download all the dependencies.


1-Go to your workspace directory » .metadata » .plugins » org.eclipse.wst.server.core folder.

2- Delete the tmp folder.

3- Restart your Eclipse IDE


Create New Project and Import all files to the new project.it worked for me....


If all given answer are not working for you then just change your current workspace.

file-> switch worksspace

It would be solve your problem.


I had the same problem, and non of the answers here helped my case. So after several hours of searching I found the solution for me and I hope it'll help somebody else.

This is a solution for anyone who gets the "Server Tomcat v7.0 Server at localhost failed to start." error after configuring the tomcat server in eclipse and trying to run a project on it.

After configuring the tomcat server in eclipse you need to copy the "WEB-INF" directory from your tomcat. C:\ ... %TOMCAT_HOME%\webapps\ROOT and their you will find the "WEB-INF" just copy and paste it in your WebContent folder in you eclipse project (overwrite the web.xml file).

Hope this helps.


in my case the error was it was not able to find servlet-api.jar. Don't know why suddenly it started giving error for that. Because previously it was running without any issue. After giving the servlet-api.jar in the build path option the server started successfully.


In my case I did deploy my tomcat folder (the one having all files in it) into an other place.

Then when I started eclipse and tried to run my project with jsp's and servlets I got this same error.

I tried all the answers here but it still didn't change anything. The solution for me was to put all tomcat JAR files into the project librarie like so:

  1. Go to Eclipse
  2. Right click on the project you work on > Build Path > Configure Build Path... > Libraries > Add External JARs
  3. select all JAR files from the Tomcat/bin and Tomcat/lib
  4. Press "Ok"

Now you should find them in the Libraries folder of your project and then it should work.


double click on apache server in eclipse server tab. now change tomacat admin port to 8010, http port change to 8082 and Ajp port change to 8011.


i encountered this problem ,becaues i define servlet mapping in servlet class and web.xml.

You must to be careful to check whether you have defined servlet mapping in your servlet class and web.xml

1)delete @WebServlet("...")

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

OR

2)delete <servlet></servlet> <servlet-mapping></servlet-mapping>

<servlet>
    <servlet-name>ServletLogin</servlet-name>
    <servlet-class>Login</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ServletLogin</servlet-name>
    <url-pattern>/login</url-pattern>
</servlet-mapping>

Reason:

I use apache tomcat 7.0 which supports servlet 3.0.

With Java EE annotations, the standard web.xml deployment descriptor is

optional. According to the servlet 3.0 specification at

http://jcp.org/en/jsr/detail?id=315


In my case, the issue was with another instance of Tomcat was running. I stopped it from services and the issue got resolved


Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to tomcat

Jersey stopped working with InjectionManagerFactory not found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring boot: Unable to start embedded Tomcat servlet container Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start Kill tomcat service running on any port, Windows Tomcat 8 is not able to handle get request with '|' in query parameters? 8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE 403 Access Denied on Tomcat 8 Manager App without prompting for user/password Difference between Xms and Xmx and XX:MaxPermSize