In-depth explanation of MyBatis technical principles and practical defects and notes

The example in Chapter 8 always fails to run. After testing for 1 day, I posted some bugs in the book and recorded it as follows. The test environment is SpringFramework4.3.2, MyBatis3.4.1, JDK1.8
1, P196 dispacher-servlet.xml Configuration problem
MappingJacksonHttpMessageConverter does not exist
Reason : MappingJacksonHttpMessageConverter has been abandoned since springframework4.0, and this class cannot be found. It is replaced by org.springframework.http.converter.json.MappingJackson2HttpMessageConverter

2, Caused by: java.lang.ClassNotFoundException:com.fasterxml .jackson.core.JsonProcessingException
added three references: jackson-annotations-2.8.5.jar, jackson-databind-2.8.5.jar, jackson-core-2.8.5.jar

3, javax.naming.NameNotFoundException: Name datasource is not bound in this Context
web.xml forgot to add JDBC reference
<resource-ref> 
    <description>datasource</description> 
    <!--Datasource name--> 
    <res-ref-name>jdbc/chapter8</res-ref-name> 
    <!--引用类型--> 
    <res-type>javax.sql.DataSource</res-type> 
    <!--容器--> 
    <res-auth>Container</res-auth> 
  </resource-ref> 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326567919&siteId=291194637