问答详情
源自:-

使用generatorConfig.xml 报错

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.imooc.utils.GeneratorDisplay.generator(GeneratorDisplay.java:25)
    at com.imooc.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:335)
    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


提问者:大虾丶米 2018-03-13 09:52

个回答

  • 风间影月
    2018-03-15 22:37:30

    更新一下插件版本,试试这个:

    <!--mybatis--><dependency>
       <groupId>org.mybatis.spring.boot</groupId>
       <artifactId>mybatis-spring-boot-starter</artifactId>
       <version>1.3.1</version>
    </dependency><!--mapper--><dependency>
       <groupId>tk.mybatis</groupId>
       <artifactId>mapper-spring-boot-starter</artifactId>
       <version>1.2.4</version>
    </dependency><!--pagehelper--><dependency>
       <groupId>com.github.pagehelper</groupId>
       <artifactId>pagehelper-spring-boot-starter</artifactId>
       <version>1.2.3</version>
    </dependency>