1
當我使用的MyBatis發電機來自動生成從MySQL映射器XML和模型,但我得到了錯誤:ClassNotFoundException的:MyBatis3Simple
[INFO] --- mybatis-generator-maven-plugin:1.3.0:generate (default-cli) @ loanmanager ---
java.lang.RuntimeException: Cannot instantiate object of type MyBatis3Simple
at org.mybatis.generator.internal.ObjectFactory.createInternalObject(ObjectFactory.java:136) ...
Caused by: java.lang.ClassNotFoundException: MyBatis3Simple
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
發電機配置爲:
**<generatorConfiguration>
<!--<properties resource="">-->
<!--</properties>-->
<!-- 配置成你本地的mysql-connector-java jar -->
<classPathEntry
location="/Users/shenbin/.m2/repository/mysql/mysql-connector-java/5.1.40/mysql-connector-java-5.1.40.jar" />
<context id="baseTradeTables" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
...
</context>
</generatorConfiguration>**
pom.xml中是:
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.0</version>
</plugin>
</plugins>
</build>
但如果我使用MyBatis3,它運行正常。
非常感謝你,我解決了這個問題。 – jsonbin