Why Template “Spring MVC Project” in “SpringSource Tool Suite” not work with Tomcat?

后端 未结 4 2016
陌清茗
陌清茗 2021-01-03 07:25

When Im create Spring MVC Template project in SpringSource Tool and try to Run on the Tomcat server I have this error:

WARN : org.springframework.web.servlet         


        
相关标签:
4条回答
  • 2021-01-03 08:05

    It looks to me like the url you're trying to hit is "/test/" and the web.xml is only mapping "/". You could change that to "/*" if you want spring to handle all urls, and then you'd also have to change your home controller to be "/test".

    Or you could just hit the url "http://localhost:8080/" which is the root URL that you have mapped to the home controller.

    0 讨论(0)
  • 2021-01-03 08:11

    I was getting the exact same issue and I solved it. Basically, when the Spring MVC Project gets created, Eclipse does not configure src/main/webapp as a source directory by default. It likely needs to be a source directory because then Eclipse will treat the files differently when it builds it.

    Right clicking on the 'webapp' folder and clicking 'Build Path -> Use as Source Folder' solved this issue for me. The other comments here are wrong: I did NOT have to change my RequestMapping or servlet url-pattern. '/' for both worked for my 'localhost:8080/test/'.

    0 讨论(0)
  • 2021-01-03 08:17

    After you create your Spring Template MVC Project in Eclipse, you have to build it MANUALLY, before running it on a server.

    0 讨论(0)
  • 2021-01-03 08:24

    Found a solution!

    When you start creating the project, you have to define this. (pay attention to the third level superapp )

    In order to get to the app, the url is http://localhost:8080/superapp

    That's worked for me

    0 讨论(0)
提交回复
热议问题