ssm整合-错误2


1
警告: No mapping found for HTTP request with URI [/management] in DispatcherServlet with name 'dispatcherServlet' 2 5月 24, 2018 1:05:48 下午 org.springframework.web.servlet.PageNotFound noHandlerFound 3 警告: No mapping found for HTTP request with URI [/management] in DispatcherServlet with name 'dispatcherServlet' 4 5月 24, 2018 1:05:55 下午 org.apache.catalina.startup.HostConfig deployDirectory 5 信息: Deploying web application directory D:\java\tomcat\apache-tomcat-7.0.86\webapps\manager 6 5月 24, 2018 1:05:55 下午 org.apache.catalina.startup.TldConfig execute 7 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 8 5月 24, 2018 1:05:55 下午 org.apache.catalina.startup.HostConfig deployDirectory 9 信息: Deployment of web application directory D:\java\tomcat\apache-tomcat-7.0.86\webapps\manager has finished in 82 ms 10 5月 24, 2018 1:06:05 下午 org.springframework.web.servlet.PageNotFound handleNoSuchRequestHandlingMethod 11 警告: No matching handler method found for servlet request: path '/book', method 'GET', parameters map[[empty]] 12 5月 24, 2018 1:06:11 下午 org.springframework.web.servlet.PageNotFound noHandlerFound 13 警告: No mapping found for HTTP request with URI [/management/book/list] in DispatcherServlet with name 'dispatcherServlet'

原因是

1、配置文件中路径的问题,读dispatchServlet时将jsp文件一起读入核心控制器,原来是:

 1  <servlet>
 2     <servlet-name>dispatcherServlet</servlet-name>
 3     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 4     <init-param>
 5       <param-name>contextConfigLocation</param-name>
 6       <param-value>classpath:spring.xml</param-value>
 7     </init-param>
 8   </servlet>
 9   <servlet-mapping>
10     <servlet-name>dispatcherServlet</servlet-name>
11     <url-pattern>/*</url-pattern>
12   </servlet-mapping>

修改为

 1  <servlet>
 2     <servlet-name>dispatcherServlet</servlet-name>
 3     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 4     <init-param>
 5       <param-name>contextConfigLocation</param-name>
 6       <param-value>classpath:spring.xml</param-value>
 7     </init-param>
 8   </servlet>
 9   <servlet-mapping>
10     <servlet-name>dispatcherServlet</servlet-name>
11     <url-pattern>*.do</url-pattern>
12   </servlet-mapping>

 

2、RESTful约束下,requestMapping注解使用有效,getMapping注解无效

查找得知为没有设置json的支持包,

Java下常见的Json类库有Gson、JSON-lib和Jackson等,Jackson相对来说比较高效,在项目中主要使用Jackson进行JSON和Java对象转换。

在pom.xml文件中配置依赖:

1 <dependency>
2     <groupId>com.fasterxml.jackson.core</groupId>
3     <artifactId>jackson-databind</artifactId>
4     <version>2.8.3</version>
5 </dependency>

再次启动Tomcat成功

 

转载于:https://www.cnblogs.com/thyHome/p/9086184.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值