score:60

Accepted answer

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

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

After deleting this file, you could start Eclipse with no problem.

score:0

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

score:0

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

score:0

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.

score:0

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

file-> switch worksspace

It would be solve your problem.

score:0

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

score:0

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.

score:0

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.

score:0

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.

score:0

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

score:0

enter image description here

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

score:0

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

score:0

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

score:0

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

score:0

If all the above answers don't work, a possible solution might be -

Check if there are multiple <Context> for the same resource in the server.xml of your project. If yes, remove one of the duplicates and try again.

score:1

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.

score:1

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

score:1

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.

score:1

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

score:2

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.

score:2

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.

score:2

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.

score:2

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.

score:2

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

2- Delete the tmp folder.

3- Restart your Eclipse IDE

score:4

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!

score:6

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 .

score:6

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.

score:7

Creating a new workspace can also resolve this issue..

score:8

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

score:12

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

score:13

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

score:17

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

score:23

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.

score:38

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.

score:109

  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.


Related Query

More Query from same tag