问题集合(编程报错)

更换高版本数据库

报错内容
1
java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
解决方案
1
2
3
4
5
url=jdbc:mysql://localhost:3306/bookdb?rewriteBatchedStatements=true

替换为

url=jdbc:mysql://localhost:3306/bookdb?characterEncoding=latin1&autoReconnect=true&useSSL=false&useTimezone=true&serverTimezone=UTC

Thymeleaf中each遍历

报错内容
1
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "" (template: "employeeList" - line 27, col 20)
解决方案
1
2
3
4
5
6
7
8
9
10
11
12
<td>
<a th:href="">update</a>
<a th:href="">delete</a>
</td>

替换为

<td>
<a href="">update</a>
<a href="">delete</a>
</td>

ClassNotFoundException:ContextLoadListener

报错内容
1
java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
解决方案
1
在IDEA中点击FILE>Project Structure>Atrifatcs>在右侧Output Laayout右击项目名 选择Put into Output Root > 重启Tomcat

springboot测试

报错内容
1
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
解决方案
1
检查test目录名是否一致