Reputation: 25
I'm trying to run this Maven sample project I've cloned from: https://spring.io/guides/gs/rest-service/
Instructions says that I should be seeing a "Hello World" message but all I can see is the error message below on the browser.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Dec 17 13:50:12 EET 2020 There was an unexpected error (type=Not Found, status=404).
Any ideas to fix this will be very much appreciated.
Upvotes: 0
Views: 76
Reputation: 311
Its error 404, Not Found. It means your service URL is wrong. Please provide the service url you are using to hit the Rest service. I have just imported the same project and able to run successfully. When hitting url http://localhost:8080/greeting?name=User and getting {"id":1,"content":"Hello, User!"}. Some tips 1. Import maven project from "complete" folder. 2. Just start springboot application by running Right click on->"RestServiceApplication" -->run as java. And hit the url http://localhost:8080/greeting?name=User. Note: check the port on ehich ur tomcat server started.
Upvotes: 3
Reputation: 402
Url which is open by default http://localhost:8080/
your controller doesn't cover, either access http://localhost:8080/greeting
or expand @GetMapping(value = {"/greeting", "/"})
with the default path
Upvotes: 0