【问题标题】:hibernate3-maven-plugin generates java.lang.ClassNotFoundException: org.hibernate.util.ReflectHelperhibernate3-maven-plugin 生成 java.lang.ClassNotFoundException: org.hibernate.util.ReflectHelper
【发布时间】:2012-10-27 17:57:25
【问题描述】:

我正在尝试从我的 orm.xml 文件生成架构 (ddl)。我正在使用 hibernate3-maven-plugin。我使用 JPA 和 hibernate 作为实现,但对其他实现或 maven 插件持开放态度。我的 pom.xml 中的代码是:

 <build>
    <plugins>
        <plugin>                
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>3.0</version>

            <configuration>
                <hibernatetool>
                    <jpaconfiguration persistenceunit="unitname" />

                    <hbm2ddl export="false" create="true"
                 update="true" format="true" outputfilename="schemaDiff.ddl" />

                </hibernatetool>
            </configuration>
        </plugin>            
    </plugins>
</build>

我运行的命令是:

mvn hibernate3:hbm2ddl -e

我收到的错误是:

引起:java.lang.NoClassDefFoundError: org/hibernate/util/ReflectHelper 在 org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:32) 在 org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54) 在 org.hibernate.tool.ant.HibernateToolTask​​.getConfiguration(HibernateToolTask​​.java:302) 在 org.hibernate.tool.ant.Hbm2DDLExporterTask.createExporter(Hbm2DDLExporterTask.java:51) 在 org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39) 在 org.hibernate.tool.ant.HibernateToolTask​​.execute(HibernateToolTask​​.java:186) 在 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method.invoke(Method.java:597) 在 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) ... 28 更多

引起:java.lang.ClassNotFoundException:org.hibernate.util.ReflectHelper 在 org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) 在 org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) 在 org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) ... 40 更多

【问题讨论】:

标签: maven jpa-2.0 ddl hibernate3-maven-plugin


【解决方案1】:

George Herolyants 在这里提出了一个解决方案。

http://doingenterprise.blogspot.com/2012/05/schema-generation-with-hibernate-4-jpa.html

【讨论】:

    猜你喜欢
    • 2014-10-09
    • 2012-03-05
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 2011-08-20
    • 1970-01-01
    • 2011-06-11
    相关资源
    最近更新 更多