简体   繁体   中英

Tomcat reporting 404 error on all of newly deployed WAR files?

I deployed a WAR file into $TOMCAT_HOME/webapps by copying the file into the directory, just like I've done a thousand times before. Tomcat detects the WAR and inflates it. I can traverse the directory tree on my server at the command line (it's Fedora).

But when I address the webapp within my client machine's browser, I get nothing but 404 errors. This has happened to the last two deployments of completely separate WARs.

The first was a replacement of an existing WAR. I first deleted the WAR and its inflated directory, and then copied in the WAR which inflated... 404. I deleted everything again, put back the previously working WAR from backup. It inflated and worked.

The second was a completely new, never before deployed WAR... nothing but 404.

Other WARs are working, but now I'm afraid to change anything until I know what is going on. Any clues?


Edit : From my comment you can see that the logs included "SEVERE: Error listenerStart" after the WAR was deployed by Tomcat. There were no stack traces or other errors reported.


Edit2 : Turns out the second WAR was looking for the ELResolver and could not find it. This was buried in the localhost log file.

You should go to the "Servers" tab and click-right on the "properties" and press the button "Switch Location". After that you make the test again. Let me know if it works. (Reference: 404 with tomcat / eclipse deployed webapp ).

If a web application does not deploy correctly you will get 404's.

You should just remove the WAR file, and let Tomcat delete the inflated war folder itself.

The ListenerError could be that the web.xml still refers to a listener, which is not in the new code you want to put in the war.

Remove the war file, clean tomcat, start, down, and then put the war again.

ONTO: Make sure that the war was generated correctly.

This problem happened to me also when I was using Tomcat. If there are no errors in the deployment, chances are, if you open the web console (Developer Tools --> Console) or Ctrl-Shift-I in Chrome, it will say that it is searching for a specific missing file.

Once you add that file back(if the above is true), Tomcat should work properly.

  1. Stop Tomcat
  2. Keep only one version of the war file
  3. Remove the inflated folder
  4. Remove the "work" folder and its contents from the tomcat base directory (or) CATALINA HOME
  5. Restart tomcat and now test the application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM