Everything seems alright but when I launch my application, I get a strange error of resource not found. This is my controller class
@Controller
public class HomeController {
@Autowired
private IMusicStoreService musicStoreService;
@RequestMapping(value="/")
public ModelAndView test(HttpServletResponse response) throws IOException{
return new ModelAndView("home","musicDetForm",new MusicDetails());
}
@RequestMapping(value="AddSong",method = RequestMethod.POST)
@ResponseBody
public String addSong(@ModelAttribute("musicDetForm") MusicDetails musicDetails){
return musicStoreService.addSong(musicDetails);
}
@RequestMapping(value = "SongList/",method = RequestMethod.GET)
@ResponseBody
public List<MusicDetails> getSongList(){
return musicStoreService.getSongList();
}
}
This is a code section from my pom.xml file
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<java.version>1.6</java.version>
<spring.version>3.1.0.RELEASE</spring.version>
<cglib.version>2.2.2</cglib.version>
</properties>
This is my web.xml file
<display-name>MusicStore</display-name>
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>SpringDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>aish.vaishno.musicstore</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
When I launch my application on tomcat using sts, no error is shown on my build but I get this error
HTTP Status 404 - /MusicStore/
Why am I getting the above error despite that my mapping seems okay.