ssm项目学习5-错误&解决方法整理篇

1.首先对于快捷键:

     导包快捷键:Ctrl+Shift+O 自动引导类包   

     Ctrl+1 快速修复   修改提示(会出现下拉框)

      Alt+/   补全代码(弹出代码提示)  

      Ctrl+Shift+F  格式化当前代码 

    Ctrl+Shift+/ 在JSP文件窗口中是 <!--~-->。

     Ctrl+/   在java代码窗口中 对光标所在的一行进行注释   再按则取消注释 

     Ctrl+Shift+M(先把光标放在需导入包的类名上) 作用是加Import语句 

2.maven项目运行报错:

java.sql.SQLException: Unknown system variable 'query_cache_size'

与mysql-connector-java的版本有关(一般是MavenRepository的导入的mysql  connector版本过低)

解决:

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>

 

3   在maven中org.apache.ibatis.annotations.Param报错的解决办法

.

import org.apache.ibatis.annotations.Param;   maven项目中导入这个出错  

解决:

第一种方式(问题原因:pom.xml未导入mybtis的配置代码):

<!--MyBatis -->
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.4.2</version>
        </dependency>

第二种方式:

只用在pom.xml中加入以下包就可以

 <!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-core -->
        <dependency>
            <groupId>org.apache.ibatis</groupId>
            <artifactId>ibatis-core</artifactId>
            <version>3.0</version>
        </dependency>
在maven中org.apache.ibatis.annotations.Param报错的解决办法
原文:https://blog.csdn.net/loveliness_peri/article/details/81158417 

第三个方法:

spring整合mybatis的时候,对mybatis的版本是有要求的,:

<--错误,不兼容-->

<dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.2.2</version>
        </dependency>

两个mybatis版本不兼容,把第一个dependency的mybatis版本提高的最新就可以解决这个问题了。改变后的结果如下所示:

<--提高mybatis版本后,正常兼容-->

原文:https://blog.csdn.net/qq_42145871/article/details/81061815 
 

 

 

 

4.mysql的时区错误问题

问题描述:

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决:

mysql>show variables like '%time_zone%';

mysql>set  global time_zone='+8:00';

执行以上两条即可

详细文章进地址:

https://blog.csdn.net/weixin_39033443/article/details/81711306

 

 

5.

报错信息:Loading class `com.mysql.jdbc.Driver'. This is deprecated

(generatorConfiguration中:DriverCLassName(jdbc版本高的话要用): com.mysql.cj.jdbc.Driver

也要在spring的配置文件的数据源配置中修改

解决:

https://blog.csdn.net/weixin_42323802/article/details/82500458

 

 

6.mybatis逆向工程运行成功却没有生成相应的包下的文件

第一种可能:

mac下路径是./src  

windows 路径是.\src

第二种可能:

 

https://blog.csdn.net/qq_37638061/article/details/81875698

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风吹海洋浪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值