Made a web project in IDEA run on Tomcat everything works no problem. Made a war file launched Tomcat on a remote computer zaplopil in Tomcat. It opens, opens the start page, and then gives the error 404 " Message / ls is probably a problem in this part of the code. But what problem can not understand.

<servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>ProjectX.web.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/ls</url-pattern> </servlet-mapping> 

enter image description here This is an error window. At first, I thought that the problem was in the Tomkat version, so I checked it on different versions. The error is the same.

enter image description here Before pressing the login button in the console writes an error 500.

  • You must reboot the server after each change in web.xml. Have you rebooted? - Sckoriy
  • If you did it and it doesn’t work - show the url - Sckoriy 5:24 pm
  • why did you decide what is the problem here? - michael_best
  • No need to write "solved" in the title. Better tick your answer and that's it. - HolyBlackCat

2 answers 2

Somewhere the application context has been lost, since it returns the address to which another application may be. The application context can be obtained / viewed by request.getContextPath() .

  • through / ls I have a login. The servlet checks the password, if it meets the requirements, it is transferred to index.jsp. For some reason, after checking it does not find index.jsp. Although he checked the war file. Rebuilding war can help? - One Plus

I experimented with different versions of Tomcat a whole week, tried TomEE, jBoss, Jetty all in vain ... each of these servers worked with problems the first time, none of them started (via IDEA). In the end, I realized that the problem was in InteliJ IDEA Ultimate itself (version 2018.2 updated to 2018.3). I rolled back to 2016.3 everything worked as it should without errors and even faster.