50

I just downloaded the Tomcat 7.0.23 package on my Ubuntu 11.10.

I followed the instructions on a Google API website to deploy their example webapp. It basically consists of jar files placed in the WEB-INF/lib directory and a web.xml file placed in the WEB-INF directory.

Yet the app is not automatically deployed and when trying to force the server to deploy it through the manager gui, I get the following message:

FAIL - Application at context path /myWebApp could not be started
FAIL - Encountered exception org.apache.catalina.LifecycleException: 
         Failed to start component 
         [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myWebApp]]

However, the JSP examples provided with Tomcat do work!

I have the same problem on Tomcat6.

So what did I do wrong ? Is this a permission problem ? (I even try to change the mod of all files to 777).

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Jean Logeart
  • 52,687
  • 11
  • 83
  • 118
  • 1
    there should be an exception before the FAIL message – Bozho Dec 14 '11 at 22:26
  • That's all i got from the Tomcat Web Application Manager GUI. If there is a specific command line I can type in a terminal to give you more info, I would be glad to do so! :) – Jean Logeart Dec 14 '11 at 22:33
  • Thanks for your advice! Actually there was a servlet-mapping on a servlet that did not exist. I did not check the web.xml file given by Google and assumed it was correct, but for some reason it was not! Thanks again, it works once the mapping is commented. – Jean Logeart Dec 14 '11 at 22:50
  • 1
    (adding an extended version of my comment as an answer) – Bozho Dec 14 '11 at 22:55
  • http://stackoverflow.com/questions/3365135/deploying-a-war-file-gives-me-a-404-status-code-on-tomcat – kervin Jul 10 '16 at 00:45

17 Answers17

63

This means something is wrong with your application configuration or startup.

There is always information about that in the logs - check logs/catalina.out and figure out what is wrong.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • 2
    Thanks for your answer! Reading the logs revealed that there was a ``servlet-mapping`` on a ``servlet`` that did not exist. I did not check the web.xml file given by Google and assumed it was correct, but for some reason it was not! Thanks again, it works once the mapping is commented. – Jean Logeart Dec 15 '11 at 08:26
  • 1
    I'm getting this exception, but nothing appears in catalina.out – Bart van Heukelom Jan 12 '13 at 20:25
  • I have the same problem as @BartvanHeukelom. I don't know what to do. – icedwater Sep 12 '13 at 10:07
  • While opening **logs/cataline.out**, it is showing the following error: **Error: Could not find or load main class org.apache.catalina.startup.Bootstrap** – Krutik Aug 04 '16 at 09:18
  • That is all fine and good for standalone Tomcat. What do we do when we encounter a [similar-looking problem in embedded Tomcat?](https://stackoverflow.com/questions/48979989/) – personal_cloud Feb 26 '18 at 18:54
  • Thanks for reminding that catalina.out exists hahaha solved my issue now. Thank you again! – Jero Dungog Nov 15 '18 at 03:13
5

I had this problem, where it just would not deploy on Tomcat , then i removed all @webServlet Annotations from all my servlet code and it deployed successfully.

user2052129
  • 231
  • 4
  • 11
  • Works for me too. Provided you also remove the init code described here: https://stackoverflow.com/questions/26089902/ Except then there are no WebServlets. Plus1 anyway for being the most relevant answer. – personal_cloud Feb 25 '18 at 23:57
  • While this works, I rely on WebServlet annotations for routing. What's the work around? – Paul Sender Jul 02 '21 at 14:11
4

Remove the servlet-api.jar from build path and just add it on web-inf lib folder and then export the WAR file..it'll work...cheers..!!!

Mayank Saini
  • 3,017
  • 24
  • 25
  • 2
    This is a special case but generally the problem is that a particular jar is missing from web-inf lib folder – kon psych Mar 28 '13 at 10:49
2

Check your WEB-INF/web.xml file for the servlet Mapping.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Gurpreet
  • 47
  • 3
1

In eclipse ... go to Servers view ... right click on the tomcat server -> Add or remove programs -> Remove all other projects. Now try to run the project. It should work.

0

I got stuck and problem solved Don't use the path that is "Map Network Drive", but use the \server\folder structure instead

Alex
  • 1
0

I done in same way and its working now. Actually web.xml file having wrong url-pattern. you can remove one url-pattern either annotation form servlet or web.xml.It worked for me.

0

I got out of memory error with when facing such phenomena:

Caused by: java.lang.OutOfMemoryError: PermGen space

after freeing some memory, the problem is solved.

wgui
  • 83
  • 1
  • 1
  • 4
0

There is also change that Eclipse Project is somehow corrupted. Usually case like this Eclipse is added some duplicated .jars in your project and those .jars are usually same as Maven Dependency .jars.

If your project look like below example there is huge change that Maven Dependencies are duplicated and should be removed manually.


e.g. (Project Explorer View)
src/main/java
src/test/java
spring-boot-vaadin.jar
spring-aop.jar
Maven Dependencies
  spring-boot-vaadin.jar
  spring-aop.jar
etc...

...and this is cure :-)


Project/Properties/Java Build Path/Libraries

Just remove all REPO_M2/... paths and update project.

Juha Hanka
  • 639
  • 6
  • 5
0


Tomcat has different WAR deployment ways. Some work, some don't. Please try the following deployment methods :

  • Automatic: Copy-paste your WAR file into ${CATALINA_HOME}/webapps. A folder with the same name will appear if everything goes right.
  • Manager Application: Upload the WAR file
  • Manager Application: Locate the WAR file

In my case, using the Manager Application (local URL: http://localhost:8080/manager) worked. Whereas deploying using a copy-paste resulted in your error.
Etienne Tonnelier
  • 2,119
  • 1
  • 15
  • 14
0

I got this error when deploying a war file to Tomcat. My project required Java 1.8, and it turned out only Java 1.7 was installed. It wasn't immediately obvious from any log file that I could find.

jkerak
  • 287
  • 3
  • 13
0

For me the problem was caused by checking the project into an other directory from Git. Choosing the same name as the war file solved the problem.

jcomouth
  • 324
  • 3
  • 16
0

I got this error when there was no enough space in server. check logs and server spaces

Chinthaka Dinadasa
  • 3,332
  • 2
  • 28
  • 33
0

Might be super trivial but worth a check prior to waste some time.

At my case the mysql service was down.

When you have a java app including JPA / Hibernate it is checking the database connection on startup. Just found out by looking into the looks where it had an entity manager error.

Cyber
  • 2,194
  • 4
  • 22
  • 41
0

This might be caused by issue in your code. In my case, for instance,

I had Mongo database pointing to my local(done this for testing and forgot to update it back) instead of the one on EC2 which is the same machine 
        where war file is deployed to. 

How did I figured it out? I had to compare with older version of the code which works fine.

Tadele Ayelegn
  • 4,126
  • 1
  • 35
  • 30
0

I also faced this due to Tomcat version mismatching! According to the documentation, the default tomcat version of Grails 4.0.x is tomcat 8 but in the server that I was using had the tomcat version of 9.0.31!

in the build.gradle file I changed compile "org.springframework.boot:spring-boot-starter-tomcat" to provided "org.springframework.boot:spring-boot-starter-tomcat" and added/modified the cache plugin to compile "org.grails.plugins:cache", { exclude group: "org.codehaus.groovy", module: "groovy-all" } under dependencies block! [Cache plugin comes with groovy-all 2.1]

It worked like a charm! Strangely, this did not cause any problems when running the app with command grails run-app

ani0904071
  • 362
  • 2
  • 11
0

Im using XAMPP and I upgraded only Tomcat version to Tomcat8 version

i stopped tomcat service on xampp and Renamed the old Tomcat folder to "tomcat_old"

c:\xampp\tomcat_old

(If u have problem renaming then use a free tool as LockHunter to unlock files)

So i downloaded tomcat8 and copied only the project files (that contain folders bin, conf etc) to my tomcat folder ;

c:\xampp\tomcat 

Then I check

C:\xampp\xampp-control.ini

Changed this file as below:

[BinaryNames]
Apache=httpd.exe
MySQL=mysqld.exe
FileZilla=filezillaserver.exe
FileZillaAdmin=filezilla server interface.exe
Mercury=mercury.exe
Tomcat=tomcat7.exe <--- I changed this to: Tomcat=tomcat8.exe after upgrading tomcat

[ServiceNames]
Apache=Apache2.4
MySQL=mysql
FileZilla=FileZillaServer
Tomcat=Tomcat7 <--- I changed this to: Tomcat=Tomcat8

Saved the file and restored the old tomcat users from tomcat-users.xml in the old tomcat conf folder to the new conf folder

Restart Tomcat and it worked