mysql - Hibernate逆向工程错误

标签 mysql hibernate

我需要一些帮助来解决这个 Hibernate 错误。

我的环境是:

  • Eclipse Kepler 服务版本 1
  • hibernate 3.6.9
  • MySql 5.5

这是我的 hibernate.cfg.xml :

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
 <session-factory>
   <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">LexoR</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/s2me</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.default_schema">s2me</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
 </session-factory>
</hibernate-configuration>

这是 hibernate.reveng.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

    <hibernate-reverse-engineering>
      <table-filter match-schema="s2me" match-name=".*"/>
    </hibernate-reverse-engineering>

And the error log whne I try to generate the POJO files:

org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class

org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
    at org.jboss.tools.hibernate3_6.console.ConsoleExtension3_6.launchExporters(ConsoleExtension3_6.java:149)
    at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:270)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.reveng.OverrideRepository
    at org.jboss.tools.hibernate3_6.console.ConsoleExtension3_6$3.execute(ConsoleExtension3_6.java:249)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
    at org.jboss.tools.hibernate3_6.HibernateExtension3_6.execute(HibernateExtension3_6.java:201)
    at org.jboss.tools.hibernate3_6.console.ConsoleExtension3_6.buildConfiguration(ConsoleExtension3_6.java:239)
    at org.jboss.tools.hibernate3_6.console.ConsoleExtension3_6.runExporters(ConsoleExtension3_6.java:169)
    at org.jboss.tools.hibernate3_6.console.ConsoleExtension3_6.launchExporters(ConsoleExtension3_6.java:126)
    ... 6 more

我的 Google 搜索没有找到任何帮助。 有什么帮助吗? 谢谢

最佳答案

您的逆向工程工具已经有 hibernate jar,并且与您的 hibernate jar 冲突。我知道您使用的是哪种逆向工程工具。我猜这是 JBoss 逆向工程工具?最好使用其他替代方案,如 MyEclipse 或 Intellij。这可以用少量资金为您节省大量时间。

关于mysql - Hibernate逆向工程错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23838918/

相关文章:

java - hibernate 保存后复合 ID 不会改变

php - 多个多对多关系的最佳 MySql 数据库设计

PHP Foreach 循环添加空白 MySQL 条目

php - 将具有 unix 时间戳值的 PHP 字符串转换为 MySQL 时间戳值

java - Spring boot应用程序创建两个数据库行

java - MySQL max_allowed_pa​​cket 随机更改为 1024 字节

hibernate - 非法参数异常 : Not an entity - distributed model definitions in hibernate/jpa and Maven

java - 使用 Spring Security Autowiring 依赖注入(inject)

java - Spring Data JPA 的 @PersistenceConstructor 注释是否与 Hibernate 结合使用?

spring - JPA/Hibernate : create database schema and import data on first run, 在后续运行中更新架构