java bug记录

1、报错:You must configure either the server or JDBC driver (via the serverTimezone conf)

这是由于mysql时区问题导致,默认是美国时区,而我们会比他们迟8个小时。

解决方式:

i:jdbc加载的时候: ?serverTimezone=GMT%2B8

ii:使用低版本的mysql数据库

 

2、报错: The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary

引入升级后的mysql驱动类,Driver位置由com.mysql.jdbc.Driver 变为com.mysql.cj.jdbc.Driver 

解决方式:

将加载驱动类配置为 com.mysql.cj.jdbc.Driver 

 

3、Class path contains multiple SLF4J bindings

这是由于springboot默认的日志是logback和我们自己引入的log4j2包冲突。

解决方式:在依赖中去除默认引用的包即可

    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

 4、tomcat7:run运行时候,javax.annotation不存在

由于idea用的jdk版本高

解决方式:降低版本

file--Project Structure

 

posted @ 2020-04-09 10:23  yewook  阅读(186)  评论(0编辑  收藏  举报