java.lang.RuntimeException: Cannot instantiate object of type tk.mybatis.mapper.generator.MapperPlugin

来源:8-1 整合MyBatis - 使用generatorConfig生成mapper以及pojo

慕粉1749239064

2018-08-15 14:45

D:\development\java\bin\java "-javaagent:D:\development\IDEA\IntelliJ IDEA 2017.1.2\lib\idea_rt.jar=58878:D:\development\IDEA\IntelliJ IDEA 2017.1.2\bin" -Dfile.encoding=UTF-8 -classpath D:\development\java\jre\lib\charsets.jar;D:\development\java\jre\lib\deploy.jar;D:\development\java\jre\lib\ext\access-bridge-64.jar;D:\development\java\jre\lib\ext\cldrdata.jar;D:\development\java\jre\lib\ext\dnsns.jar;D:\development\java\jre\lib\ext\jaccess.jar;D:\development\java\jre\lib\ext\jfxrt.jar;D:\development\java\jre\lib\ext\localedata.jar;D:\development\java\jre\lib\ext\nashorn.jar;D:\development\java\jre\lib\ext\sunec.jar;D:\development\java\jre\lib\ext\sunjce_provider.jar;D:\development\java\jre\lib\ext\sunmscapi.jar;D:\development\java\jre\lib\ext\sunpkcs11.jar;D:\development\java\jre\lib\ext\zipfs.jar;D:\development\java\jre\lib\javaws.jar;D:\development\java\jre\lib\jce.jar;D:\development\java\jre\lib\jfr.jar;D:\development\java\jre\lib\jfxswt.jar;D:\development\java\jre\lib\jsse.jar;D:\development\java\jre\lib\management-agent.jar;D:\development\java\jre\lib\plugin.jar;D:\development\java\jre\lib\resources.jar;D:\development\java\jre\lib\rt.jar;E:\springBoot\springBoot\target\classes;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.4.RELEASE\spring-boot-starter-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot\2.0.4.RELEASE\spring-boot-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-context\5.0.8.RELEASE\spring-context-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.4.RELEASE\spring-boot-autoconfigure-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.4.RELEASE\spring-boot-starter-logging-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\pc\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\pc\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\pc\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\pc\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\pc\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\pc\.m2\repository\org\springframework\spring-core\5.0.8.RELEASE\spring-core-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-jcl\5.0.8.RELEASE\spring-jcl-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.4.RELEASE\spring-boot-starter-web-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.4.RELEASE\spring-boot-starter-json-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;C:\Users\pc\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.4.RELEASE\spring-boot-starter-tomcat-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.32\tomcat-embed-core-8.5.32.jar;C:\Users\pc\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.32\tomcat-embed-el-8.5.32.jar;C:\Users\pc\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.32\tomcat-embed-websocket-8.5.32.jar;C:\Users\pc\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.11.Final\hibernate-validator-6.0.11.Final.jar;C:\Users\pc\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\pc\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\pc\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\pc\.m2\repository\org\springframework\spring-web\5.0.8.RELEASE\spring-web-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-beans\5.0.8.RELEASE\spring-beans-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-webmvc\5.0.8.RELEASE\spring-webmvc-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-aop\5.0.8.RELEASE\spring-aop-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-expression\5.0.8.RELEASE\spring-expression-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-devtools\2.0.4.RELEASE\spring-boot-devtools-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-configuration-processor\2.0.4.RELEASE\spring-boot-configuration-processor-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-freemarker\2.0.4.RELEASE\spring-boot-starter-freemarker-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\freemarker\freemarker\2.3.28\freemarker-2.3.28.jar;C:\Users\pc\.m2\repository\org\springframework\spring-context-support\5.0.8.RELEASE\spring-context-support-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\2.0.4.RELEASE\spring-boot-starter-thymeleaf-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\thymeleaf\thymeleaf-spring5\3.0.9.RELEASE\thymeleaf-spring5-3.0.9.RELEASE.jar;C:\Users\pc\.m2\repository\org\thymeleaf\thymeleaf\3.0.9.RELEASE\thymeleaf-3.0.9.RELEASE.jar;C:\Users\pc\.m2\repository\org\attoparser\attoparser\2.0.4.RELEASE\attoparser-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\org\unbescape\unbescape\1.1.5.RELEASE\unbescape-1.1.5.RELEASE.jar;C:\Users\pc\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\pc\.m2\repository\org\thymeleaf\extras\thymeleaf-extras-java8time\3.0.1.RELEASE\thymeleaf-extras-java8time-3.0.1.RELEASE.jar;C:\Users\pc\.m2\repository\com\alibaba\druid\1.0.0\druid-1.0.0.jar;C:\Users\pc\.m2\repository\org\mybatis\generator\mybatis-generator-core\1.3.2\mybatis-generator-core-1.3.2.jar;C:\Users\pc\.m2\repository\mysql\mysql-connector-java\5.1.41\mysql-connector-java-5.1.41.jar;C:\Users\pc\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;C:\Users\pc\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.4.RELEASE\spring-boot-starter-jdbc-2.0.4.RELEASE.jar;C:\Users\pc\.m2\repository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;C:\Users\pc\.m2\repository\org\springframework\spring-jdbc\5.0.8.RELEASE\spring-jdbc-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\springframework\spring-tx\5.0.8.RELEASE\spring-tx-5.0.8.RELEASE.jar;C:\Users\pc\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;C:\Users\pc\.m2\repository\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;C:\Users\pc\.m2\repository\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-spring-boot-starter\2.0.4-beta2\mapper-spring-boot-starter-2.0.4-beta2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-core\1.0.5-beta2\mapper-core-1.0.5-beta2.jar;C:\Users\pc\.m2\repository\javax\persistence\persistence-api\1.0\persistence-api-1.0.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-base\1.0.5-beta2\mapper-base-1.0.5-beta2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-weekend\1.1.4.1-beta2\mapper-weekend-1.1.4.1-beta2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-spring\1.0.5-beta2\mapper-spring-1.0.5-beta2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-extra\1.0.5-beta2\mapper-extra-1.0.5-beta2.jar;C:\Users\pc\.m2\repository\tk\mybatis\mapper-spring-boot-autoconfigure\2.0.4-beta2\mapper-spring-boot-autoconfigure-2.0.4-beta2.jar;C:\Users\pc\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.5\pagehelper-spring-boot-starter-1.2.5.jar;C:\Users\pc\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.5\pagehelper-spring-boot-autoconfigure-1.2.5.jar;C:\Users\pc\.m2\repository\com\github\pagehelper\pagehelper\5.1.4\pagehelper-5.1.4.jar;C:\Users\pc\.m2\repository\com\github\jsqlparser\jsqlparser\1.0\jsqlparser-1.0.jar com.example.springBoot.com.test.utils.GeneratorDisplay
Wed Aug 15 14:42:05 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
java.lang.RuntimeException: Cannot instantiate object of type tk.mybatis.mapper.generator.MapperPlugin
    at org.mybatis.generator.internal.ObjectFactory.createInternalObject(ObjectFactory.java:184)
    at org.mybatis.generator.internal.ObjectFactory.createPlugin(ObjectFactory.java:221)
    at org.mybatis.generator.config.Context.generateFiles(Context.java:491)
    at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:234)
    at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:133)
    at com.example.springBoot.com.test.utils.GeneratorDisplay.generator(GeneratorDisplay.java:25)
    at com.example.springBoot.com.test.utils.GeneratorDisplay.main(GeneratorDisplay.java:32)
Caused by: java.lang.ClassNotFoundException: tk.mybatis.mapper.generator.MapperPlugin
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.mybatis.generator.internal.ObjectFactory.internalClassForName(ObjectFactory.java:150)
    at org.mybatis.generator.internal.ObjectFactory.createInternalObject(ObjectFactory.java:180)
    ... 6 more

Process finished with exit code 0

写回答 关注

4回答

  • qq_漆阳_0
    2019-09-02 12:15:57

    我也遇到了这个问题,按照你的做法也ok了,但是还是不明白为什么

  • 慕雪6104141
    2018-10-31 15:16:20

    我也遇到了相同的问题,在pom.xml中添加,解决了

    <dependency>
        <groupId>tk.mybatis</groupId>
        <artifactId>mapper</artifactId>
        <version>4.0.3</version>
    </dependency>


  • hemimTNT
    2018-08-30 22:18:20

    版本号不对,访问github上的readme.md的版本

  • 韦煾
    2018-08-18 23:36:53

    ClassNotFoundException肯定是jar包问题,请看下mapper-3.5.3.jar包里的这个类反编译后能否打开。

    如果还是不行,换下tk.mybatis的其他版本

SpringBoot开发常用技术整合

SpringBoot 极简开发的框架整合利器

102174 学习 · 508 问题

查看课程

相似问题