1. Mapper.xml中的SQL语句错误导致的2. java.io.IOException: Could not find resource mybatis-config.xml3. ERROR:Caused by: java.lang.ClassNotFoundException: com.alibaba.fastjson.JSON4. 端口占用异常5. springBoot启动错误6. 数据库版本问题:7. IDEA中Maven项目的web.xml中报错:cannot resolve servlet 'spring-mvc'8. org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 199.No qualifying bean of type 'java.util.concurrent.ScheduledExecutorService' available10. org.apache.ibatis.binding.BindingException: Type interface com.hh.mapper.UserMapper is not known to the MapperRegistry.
1. Mapper.xml中的SQL语句错误导致的Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'deletes from mybatis.user where id=5' at line 1
deletes from mybatis.user where id=#{id}; 错误
delete from mybatis.user where id=#{id};
2. java.io.IOException: Could not find resource mybatis-config.xmldelete from mybatis.user where id=#{id};
异常:
java.io.IOException: Could not find resource mybatis-config.xml
解决:
3. ERROR:Caused by: java.lang.ClassNotFoundException: com.alibaba.fastjson.JSONsrc/main/java ***.xml false src/main/resources ***.xml false
ERROR:Caused by: java.lang.ClassNotFoundException: com.alibaba.fastjson.JSON
导包进去没有 引用异常 在 Project Structure——Artifacts——lib 添加包
Failed to start component [Connector[HTTP/1.1-80]]
这个错误是端口被占用了 ,有两种解决办法:
(1)停掉占用的端口再启动现在使用的端口
win+R cmd 进入命令行 netstat -ano ----所有端口的情况 netstat -aon|findstr "80" ----占用80端口的PID 例如2524 tasklist|findstr "2524" ----找到PID为2524的进程 ,可以打开任务管理器停掉该应用
(2)更换端口号
端口占用异常是可以避免的,就是在建立端口时先去查询一下该端口是否被占用了,然后选择没有被占用的端口使用即可
***查看端口是否被占用 netstat -aon|findstr "9527"5. springBoot启动错误
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder
网上大佬们说是springBoot与springCloud的版本不一样导致的,
所以建议在版本选定时去 spring官网上查看一下版本搭配问题
mysql 5.+ com.mysql.jdbc.Driver
mysql 8.+ com.mysql.cj.jdbc.Driver
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/hhmybatis?useSSL=true&useUnicode=true&characterEncoding=UTF-8 username=root password=123456
数据库版本问题——Spring整合mybatis遇到的坑
mybatis-spring整合包【重点】
mybatis:使用3.5+的; mybatis-spring就必须使用 2.0+的 ; spring:5.0+ ; Java:8+
mybatis:使用3.4+的; mybatis-spring就必须使用 1.3+的 ; spring:3.2.2+ ; Java:6+
IDEA中Maven项目的web.xml中报错,在红字部分Ctrl+F1,提示cannot resolve servlet ‘spring-mvc’
cannot resolve servlet 'spring-mvc'
解决:
在File>Project Structure>Modules>Web中,配置web.xml和web资源目录
(拷贝过来用的会报,需要手动配置,配置完后要重新部署运行项目)
Unable to process Jar entry [meta-INF/versions/9/module-info.class] from Jar [jar:file: /F:/javawls/apache-maven-3.6.3-bin/maven_repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19
类似于:「Java.lang.UnsupportedClassVersionError:Unsupported major.minor version 51.0」
不支持类版本错误。
更改JDK版本:
File-Project sturcture-projects
File-Project sturcture-Modules
manager 报 :
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'java.util.concurrent.ScheduledExecutorService' available
springboot开启定时任务启动输出异常,但功能正常
其实这个异常不影响其他功能的实现,你可以不处理,但是如果你觉得看着难受的话,也可以参考该文章解决,我查找了很多解决的文章,这个是我认为最详细的,推荐推荐
解决:



