java.lang.RuntimeException: Exception getting JDBC Driver
at org.mybatis.generator.internal.db.ConnectionFactory.getDriver(ConnectionFactory.java:85)
at org.mybatis.generator.internal.db.ConnectionFactory.getConnection(ConnectionFactory.java:54)
at org.mybatis.generator.config.Context.getConnection(Context.java:526)
at org.mybatis.generator.config.Context.introspectTables(Context.java:436)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:222)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:133)
at GeneratorMain.main(GeneratorMain.java:29)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.mybatis.generator.internal.ObjectFactory.internalClassForName(ObjectFactory.java:150)
at org.mybatis.generator.internal.ObjectFactory.externalClassForName(ObjectFactory.java:121)
at org.mybatis.generator.internal.db.ConnectionFactory.getDriver(ConnectionFactory.java:82)
at org.mybatis.generator.internal.db.ConnectionFactory.getDriver(ConnectionFactory.java:85)
at org.mybatis.generator.internal.db.ConnectionFactory.getConnection(ConnectionFactory.java:54)
at org.mybatis.generator.config.Context.getConnection(Context.java:526)
at org.mybatis.generator.config.Context.introspectTables(Context.java:436)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:222)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:133)
at GeneratorMain.main(GeneratorMain.java:29)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.mybatis.generator.internal.ObjectFactory.internalClassForName(ObjectFactory.java:150)
at org.mybatis.generator.internal.ObjectFactory.externalClassForName(ObjectFactory.java:121)
at org.mybatis.generator.internal.db.ConnectionFactory.getDriver(ConnectionFactory.java:82)
... 6 more
出现这个问题,网上查了不少问题,有的是吧mysql-connector-java-5.1.34.jar放到tomcat的lib里面,那是web工程错误,有的是bulidparh,那是jar包没有添加到工程里,我的错误已经错了好多次,是引用资源文件,后面有空格,导致属性读取错误造成成的,记下,防止后面犯类似错误。