Problem Description
The following content is based on the ssm framework. When we initiate a request to the tomcat server, the following error status prompt –500 appears.
Tomcat日志信息:
Cause Analysis:
No converter found for return value of type: class com.ssm.utils.Msg, an exception occurred while binding data using jackson.
solution:
Check 1: Whether to add jackson's related dependencies to pom.xml
<!--jackson数据绑定相关依赖jar开始-->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<!--jackson数据绑定相关依赖jar结束-->
Check 2: Whether the gettter/setter method has been added to the wrong class.
Check 3: Whether the spring-mvc annotation driver has been enabled.
<!--开启注解驱动 配置最新的处理器映射器 处理适配器-->
<mvc:annotation-driven/>
Check 4: Whether the annotation @ResponseBody or @RequestParam has been added.
Check five: If the passed parameter is a java entity class object, you need to add @RequestBody in front and implement the serialization method of the entity class.
Check 6: When you reach this step and still have not solved the problem, please confirm whether the jar package of jackson has been added to the lib directory.