On Jelastic, the demo server has deployed its Java project, but how it didn’t try to start it returns a 404 error, and on the local one, is everything okay?

on web.xml <url-pattern>/test</url-pattern>

On Jelastic, when unfolded, gave the same name test

and when I run it returns 404 error

web.xml

 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/test</url-pattern> </filter-mapping> </web-app> 

Servlet:

 @Controller @RequestMapping("/test") public class MainController { @RequestMapping(method = RequestMethod.GET) public String start(Model model){ return "index"; } } 
  • Perhaps with the registration of the servlet something screwed up. Show web.xml, as well as the servlet-class. - Vladimir Glinskikh

1 answer 1

To correctly apply the url-pattern you need in the web.xml file, you need to replace <url-pattern>/test</url-pattern> with a pattern of this format:

 <url-pattern>/test/*</url-pattern> 

Update

The main problem here is that IntelliJ, unlike Eclipse, does not automatically compile a class when it is saved, even if you selected Build on save . You need to configure the project as indicated in the documentation .

  • It did not help for some reason - Aslan Kussein
  • What IDE did you use to create this Java project? - leo
  • Intellij___idea - Aslan Kussein