Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exiting from "ERROR" dispatch, status 404

**i have tried this problems to solve more than couple of hours but i could not, "i have a simple mvc application in java spring boot when i run the program it says following error" so what are the steps to get rid of this massage , i tried by adding component scan at application.java but it dose not work out **


2020-03-02 10:19:17.510  INFO 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 3 ms
2020-03-02 10:19:17.516 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : GET "/Registration", parameters={}
2020-03-02 10:19:17.519 DEBUG 16708 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.rohit.flightreservation.controller.UserController#ShowRegistration()
2020-03-02 10:19:17.533 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-03-02 10:19:17.533 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : View name 'login/registration', model {}
2020-03-02 10:19:17.534 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Forwarding to [login/registration]
2020-03-02 10:19:17.536 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : "FORWARD" dispatch for GET "/login/registration", parameters={}
2020-03-02 10:19:17.538 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2020-03-02 10:19:17.539 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler     : Resource not found
2020-03-02 10:19:17.539 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Exiting from "FORWARD" dispatch, status 404
2020-03-02 10:19:17.540 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed 404 NOT_FOUND
2020-03-02 10:19:17.540 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : "ERROR" dispatch for GET "/error", parameters={}
2020-03-02 10:19:17.540 DEBUG 16708 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml(HttpServletRequest, HttpServletResponse)
2020-03-02 10:19:17.545 DEBUG 16708 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, text/html;q=0.8]
2020-03-02 10:19:17.549 DEBUG 16708 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Exiting from "ERROR" dispatch, status 404
2020-03-02 10:19:18.319 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : GET "/Registration", parameters={}
2020-03-02 10:19:18.319 DEBUG 16708 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.rohit.flightreservation.controller.UserController#ShowRegistration()
2020-03-02 10:19:18.320 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-03-02 10:19:18.320 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.servlet.view.InternalResourceView  : View name 'login/registration', model {}
2020-03-02 10:19:18.320 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.servlet.view.InternalResourceView  : Forwarding to [login/registration]
2020-03-02 10:19:18.320 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : "FORWARD" dispatch for GET "/login/registration", parameters={}
2020-03-02 10:19:18.320 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2020-03-02 10:19:18.321 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.s.r.ResourceHttpRequestHandler     : Resource not found
2020-03-02 10:19:18.321 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Exiting from "FORWARD" dispatch, status 404
2020-03-02 10:19:18.321 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed 404 NOT_FOUND
2020-03-02 10:19:18.321 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : "ERROR" dispatch for GET "/error", parameters={}
2020-03-02 10:19:18.322 DEBUG 16708 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml(HttpServletRequest, HttpServletResponse)
2020-03-02 10:19:18.323 DEBUG 16708 --- [nio-8080-exec-2] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, text/html;q=0.8]
2020-03-02 10:19:18.323 DEBUG 16708 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Exiting from "ERROR" dispatch, status 404
2020-03-02 10:19:18.499 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : GET "/Registration", parameters={}
2020-03-02 10:19:18.500 DEBUG 16708 --- [nio-8080-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.rohit.flightreservation.controller.UserController#ShowRegistration()
2020-03-02 10:19:18.501 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2020-03-02 10:19:18.501 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.servlet.view.InternalResourceView  : View name 'login/registration', model {}
2020-03-02 10:19:18.501 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.servlet.view.InternalResourceView  : Forwarding to [login/registration]
2020-03-02 10:19:18.501 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : "FORWARD" dispatch for GET "/login/registration", parameters={}
2020-03-02 10:19:18.502 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2020-03-02 10:19:18.503 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.s.r.ResourceHttpRequestHandler     : Resource not found
2020-03-02 10:19:18.503 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : Exiting from "FORWARD" dispatch, status 404
2020-03-02 10:19:18.503 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : Completed 404 NOT_FOUND
2020-03-02 10:19:18.503 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : "ERROR" dispatch for GET "/error", parameters={}
2020-03-02 10:19:18.504 DEBUG 16708 --- [nio-8080-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml(HttpServletRequest, HttpServletResponse)
2020-03-02 10:19:18.505 DEBUG 16708 --- [nio-8080-exec-4] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, text/html;q=0.8]
2020-03-02 10:19:18.505 DEBUG 16708 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet        : Exiting from "ERROR" dispatch, status 404


my Controller is here

package com.rohit.flightreservation.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UserController {
    @RequestMapping ("/Registration")
    public ModelAndView ShowRegistration() {
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("login/registration");
        return modelAndView;
    }
}

And here is my application

package com.rohit.flightreservation;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class FlightreservationApplication {

    public static void main(String[] args) {
        SpringApplication.run(FlightreservationApplication.class, args);
    }

}

like image 598
rohit tamang Avatar asked May 19 '26 09:05

rohit tamang


1 Answers

Put @ResponseBody annotation at top of ShowRegistration(-) method, it should work.

like image 189
Prasanth Avatar answered May 21 '26 23:05

Prasanth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!