【问题标题】:No mapping found for HTTP request with URI - PageNotFound noHandlerFound找不到带有 URI 的 HTTP 请求的映射 - PageNotFound noHandlerFound
【发布时间】:2015-10-23 03:52:58
【问题描述】:

我在春季的经验很少,想在春季开发一个应用程序。 收到以下错误:

Oct 23, 2015 1:13:37 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/<app>/admin/device/admin/device/getClosestReviewers] in DispatcherServlet with name 'app'

以这种方式调用 url, http://localhost:8080/app/admin/device/getClosestReviewers?deviceId=5b0d9a27-b0f8-43c9-8a4f-59cc1ba63653&radius=6

我错过了什么,我尝试了几种方法,但似乎没有任何效果

@RequestMapping(method = RequestMethod.GET, value = "/getClosestReviewers", produces = "application/json")
public JSONResponse getClosestReviewers(@RequestParam("deviceId") String deviceId,@RequestParam("radius") int radius) {
    JSONResponse response = new JSONResponse();


    return response;
}

【问题讨论】:

  • 将你的 web.xml 和 spring 上下文文件添加到你的帖子中,然后它会给出清晰的图片。

标签: spring spring-mvc


【解决方案1】:

我认为您为 RequestMapping 提供的值不正确。你有任何类级别的 RequestMapping 吗?

【讨论】:

  • 是的,我有以下映射 @Controller @RequestMapping("admin/device") 公共类 DeviceServiceImpl 实现 DeviceService 。而且,不知道为什么“admin/device”在解析 url 时被引用了两次没有找到带有 URI [/app/admin/device/admin/device/getClosestReviewers] 的 HTTP 请求的映射
  • 您能提供您的 web.xml 或等效的 java 配置吗?
  • apporg.springframework.web.servlet.DispatcherServletapp/
  • 其他控制器的行为是否类似? /admin/device 是否会添加到所有映射的前面?
  • 它被附加到所有映射中
猜你喜欢
  • 2012-04-16
  • 2015-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-04
  • 2016-05-03
  • 1970-01-01
  • 2016-02-05
相关资源
最近更新 更多