赞
踩
找了好多错误,也改了很多地方,最好不信胁还是改成了8.0.28的版本,没想到,还真对了。
- E:\Java\Environment\jdk1.8\bin\java.exe "-javaagent:D:\AppAdd1\idea\IntelliJ IDEA 2021.3.2\lib\idea_rt.jar=58630:D:\AppAdd1\idea\IntelliJ IDEA 2021.3.2\bin" -Dfile.encoding=UTF-8 -classpath E:\Java\Environment\jdk1.8\jre\lib\charsets.jar;E:\Java\Environment\jdk1.8\jre\lib\deploy.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\cldrdata.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\dnsns.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\jaccess.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\jfxrt.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\localedata.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\nashorn.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\sunec.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\Java\Environment\jdk1.8\jre\lib\ext\zipfs.jar;E:\Java\Environment\jdk1.8\jre\lib\javaws.jar;E:\Java\Environment\jdk1.8\jre\lib\jce.jar;E:\Java\Environment\jdk1.8\jre\lib\jfr.jar;E:\Java\Environment\jdk1.8\jre\lib\jfxswt.jar;E:\Java\Environment\jdk1.8\jre\lib\jsse.jar;E:\Java\Environment\jdk1.8\jre\lib\management-agent.jar;E:\Java\Environment\jdk1.8\jre\lib\plugin.jar;E:\Java\Environment\jdk1.8\jre\lib\resources.jar;E:\Java\Environment\jdk1.8\jre\lib\rt.jar;E:\Java\Project\maven\mybatis-demo\target\classes;C:\Users\lenovo\.m2\repository\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;C:\Users\lenovo\.m2\repository\mysql\mysql-connector-java\5.1.34\mysql-connector-java-5.1.34.jar;C:\Users\lenovo\.m2\repository\org\slf4j\slf4j-api\1.5.6\slf4j-api-1.5.6.jar;C:\Users\lenovo\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\lenovo\.m2\repository\ch\qos\logback\logback-core\1.0.6\logback-core-1.0.6.jar com.example.test.MyBatisDemo1
- Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
- ### Error querying database. Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver
- ### The error may exist in UserMapper.xml
- ### The error may involve test.selectAll
- ### The error occurred while executing a query
- ### Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver
- at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:135)
- at com.example.test.MyBatisDemo1.main(MyBatisDemo1.java:27)
- Caused by: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver
- at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.initializeDriver(UnpooledDataSource.java:244)
- at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:223)
- at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:219)
- at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:95)
- at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:432)
- at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:89)
- at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:139)
- at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:61)
- at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:337)
- at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
- at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
- at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
- at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
- at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
- at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
- ... 3 more
-
- Process finished with exit code 1
回去又试了一遍,确实是mysql的问题,我之前写的是5.1.34,还是出错,改成了8.0.28,好了就。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。