0

So i'm trying to do the https://spring.io/guides/gs/rest-service/#scratch guide and i'm installing the maven project by doing "run as" "maven build" with clean install in the goal option. I can't figure out what is the problem. I'm also using m2e plugin to run the maven build, because i searched others answers and people say that using eclipse maven command line is awful.

But i get this error in the broswer at http://localhost:8080/greeting

HTTP Status 404 – Not Found Type Status Report

Message /greeting

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.31

The build is successfull tho:

https://pastebin.com/QJtxyjxV

I have pasted it here because stack overflow marks it as spam and also i pasted a few line of codes again because the link was not being accepted :/

mockHttpServletRequest:
      HTTP Method = GET
      Request URI = /greeting
       Parameters = {}
          Headers = []
             Body = null
    Session Attrs = {}

Handler:
             Type = com.example.restservice.GreetingController
           Method = com.example.restservice.GreetingController#greeting(String)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Content-Type:"application/json"]
     Content type = application/json
             Body = {"id":1,"content":"Hello, World!"}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

MockHttpServletRequest:
      HTTP Method = GET
      Request URI = /greeting
       Parameters = {name=[Spring Community]}
          Headers = []
             Body = null
    Session Attrs = {}

Handler:
             Type = com.example.restservice.GreetingController
           Method = com.example.restservice.GreetingController#greeting(String)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Content-Type:"application/json"]
     Content type = application/json
             Body = {"id":2,"content":"Hello, Spring Community!"}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
ScottexBoy
  • 452
  • 1
  • 4
  • 17
  • Does this answer your question? [Cannot access spring boot application after deployment in tomcat](https://stackoverflow.com/questions/36055729/cannot-access-spring-boot-application-after-deployment-in-tomcat) – seenukarthi Feb 13 '20 at 05:34

1 Answers1

0

Apart from maven build, run the spring boot application class which starts the application. Run below command in project level.

mvn spring-boot:run

If you use any IDE, right click Spring boot Application class and invoke "Run Application".

kann
  • 687
  • 10
  • 22