ssm整合-错误2
Posted floatthy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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成功
以上是关于ssm整合-错误2的主要内容,如果未能解决你的问题,请参考以下文章