Reputation: 863
I'm kinda new with Spring MVC and now I'm stuck; my app works perfectly in localhost but when I deploy the WAR file to the Tomcat server it just returns an HTTP 404 for all the spring controllers/APIs.
Note that views work just fine, but if I go to Chrome console I can see a lot of 404 errors.
This works:
http://localhost:8080/hello
This does not:
http://myServerName:8080/myapp/hello
This is my test controller:
@Controller
public class HelloController {
final Logger log = LoggerFactory.getLogger(this.getClass());
@RequestMapping(value = "/hello", method = RequestMethod.GET)
@ResponseBody
public String hello(Model model) {
log.debug("hello gets hit!");
return "{'message':'Hello Andy'}";
}
}
It seems that this is related with the routing, but I'm lost.
Upvotes: 0
Views: 1530
Reputation: 863
In case someone else is facing this, I found that the issue was happening cause tomcat was taking java 1.7 as default setting, just needed to go and change the version to 1.8 in the config file and that's it the apis are now working just fine.
Upvotes: 1