Mybatis Generator 异常错误记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012995964/article/details/53887534

本文记录在命令行运行 MyBatis Generator 下出现的错误,链接 MySQL 数据库。

本文中命令行运行 MyBatis Generator 语句如下:

java -jar mybatis-generator-core-x.x.x.jar -configfile generatorConfig.xml -overwrite

Error: Unable to access jarfile mybatis-generator-core-x.x.x.jar

即命令行中的 mybatis-generator-core-x.x.x.jar文件找不到。遇到这个错误可以通过绝对路径或复制该jar到 generatorConfig.xml 目录下。

not found mybatis generator jar

运行后,当前错误会变为其他提示。


Exception in thread “main” java.lang.RuntimeException: Exception getting JDBC Driver

在命令行中这个错误会有清晰的错误原因提示:

not found jdbc driver

错误提示中清晰的说明了异常为 jdbc.driver 的类找不到,即没有加载jdbc的jar包。应该在 generatorConfig.xml 文件中配置<classPathEntry> 元素(详见):

classPathEntry

此处的数据库驱动jar包路径为绝对路径(此处jar包与配置文件同目录)。如出现类似以下错误:

Exception in thread "main" java.lang.RuntimeException: Cannot resolve classpath entry: xx/mysql-connector-java-x.x.x.jar

表示此处的路径配置错误,修改为对应绝对路径即可。


Table configuration with catalog null, schema null, and table user did not resolve to any tables

出现这个错误表示表(此处为user表)没有创建,只要在数据库中创建对应的表即可。


参考

猜你喜欢

转载自blog.csdn.net/u012995964/article/details/53887534
今日推荐