Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

第 42 章 FAQ

目录

42.1. o.s.web.servlet.PageNotFound
42.2. HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
42.3. 同时使用 Thymeleaf 与 JSP
42.4. 排除静态内容
42.5. HTTP Status 406
42.6. Caused by: java.lang.IllegalArgumentException: Not a managed type: class common.domain.Article
42.7. {"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
42.8. @Value 取不到值
42.9. Spring boot 2.1.0
42.10. Field authenticationManager in cn.netkiller.oauth2.config.AuthorizationServerConfigurer required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
42.11. 打印 Bean 信息
42.12. The dependencies of some of the beans in the application context form a cycle
42.13. Could not read document: Invalid UTF-8 middle byte 0xd0
42.14. Field javaMailSender in cn.netkiller.rest.EmailRestController required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.
42.15. no main manifest attribute, in /srv/job-admin.jar

42.1. o.s.web.servlet.PageNotFound

解决方法,加入下面代码到 dispatcher-servlet.xml 文件中

			
<mvc:annotation-driven />			
			
		

dispatcher-servlet.xml

			
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd">

	<context:component-scan base-package="cn.netkiller.controller" />
	<mvc:annotation-driven />
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>

</beans>