ASanny opened a new issue, #7306: URL: https://github.com/apache/incubator-seata/issues/7306
## 问题 Windows 下,数据库驱动改为 `com.mysql.cj.jdbc.Driver` ,并且也已经在 `%BASEDIR%/lib/jdbc` 下添加 MySQL 驱动 `mysql-connector-java-8.0.30.jar`,但 seata-server 2.3.0 启动失败,下面是错误堆栈简要信息: ``` Caused by: org.apache.seata.common.exception.StoreException: The driver {com.mysql.cj.jdbc.Driver} cannot be found in the path D:\Seata-2.3.0\seata-server/lib/jdbc/. Please ensure that the appropriate database driver dependencies are included in the classpath. at org.apache.seata.core.store.db.AbstractDataSourceProvider.validate(AbstractDataSourceProvider.java:103) at org.apache.seata.core.store.db.AbstractDataSourceProvider.generate(AbstractDataSourceProvider.java:84) ``` ## 解决方案 经过研究源码和 `seata-server.bat` 脚本,得知源码中需要通过 `java.class.path` 系统变量得到 JDBC 驱动 jar 包,并且 jar 包还要以 `mysql-connector-java-` 作为前缀。而脚本中通过 `java -jar` 方式启动,`-classpath` 变量并没有生效。因此脚本中需要做出两点改动: - 去掉 `-classpath` 变量 - 将 `-jar "%BASEDIR%"/target/seata-server.jar` 修改为: ```powershell -cp "%BASEDIR%"/target/seata-server.jar;"%BASEDIR%"/lib org.springframework.boot.loader.PropertiesLauncher ``` ## 建议 建议在工程 `incubator-seata-2.3.0` 的 `distribution/bin` 下新增一个批处理脚本,避免许多新手遇到类似的错误无法解决。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org