代码生成时无法找到Hibernate MultiMap [英] Hibernate MultiMap cannot be found while code generation

查看:133
本文介绍了代码生成时无法找到Hibernate MultiMap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我试图通过Hibernate使用现有的数据库关系生成一些类时,它会产生一些错误:

  org.hibernate。 console.HibernateConsoleRuntimeException:收到NoClassDefFoundError,可能控制台配置类路径不完整或包含相同类的冲突版本
接收到NoClassDefFoundError,可能控制台配置类路径不完整或包含相同类的冲突版本
org.hibernate.console.HibernateConsoleRuntimeException:收到NoClassDefFoundError,可能控制台配置类路径不完整或包含相同类的冲突版本
接收到NoClassDefFoundError,可能控制台配置类路径不完整或包含相同类的冲突版本
java.lang.NoClassDefFoundError:org / apache / commons / collections / MultiMap
org / apache / commons / collections / MultiMap
java.lang.ClassNotFoundException:org。找不到byorg.jboss.tools.hibernate.runtime.v_5_1_5.0.1.Final-v20160331-1852-B88
org.apache.commons.collections.MultiMap无法找到ororg.mons.collections.MultiMap。 jboss.tools.hibernate.runtime.v_5_1_5.0.1.Final-v20160331-1852-B88

我的maven file:

 < build> 
< sourceDirectory> src< / sourceDirectory>
< plugins>
< plugin>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 3.3< / version>
<配置>
< source> 1.8< / source>
< target> 1.8< / target>
< / configuration>
< / plugin>
< / plugins>
< / build>
<依赖关系>
< dependency>
< groupId> org.firebirdsql.jdbc< / groupId>
< artifactId> jaybird-jdk18< / artifactId>
< version> 2.2.10< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-core< / artifactId>
< version> 5.1.0.Final< / version>
< /依赖关系>
< dependency>
< groupId> commons-collections< / groupId>
< artifactId> commons-collections< / artifactId>
< version> 3.2.2< / version>
< /依赖关系>



我看到apache common-collections jar在Maven Dependencies中,我可以在我的代码中使用apache的MultiMap。

解决方案

我有同样的问题。下面是我如何解决它:
打开编辑配置对话框,进入类路径选项卡,删除项目名称(默认类路径),单击按钮添加项目...添加您的项目。
然后它就可以工作了。

或者你可以尝试使用以前的版本而不是v5.1。在hibernate透视图中,您的配置/ Edit配置,将hibernate版本更改为v4.3之类的先前版本。


While i'm trying generate some classes by Hibernate using existing db relation it generates some error:

org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
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
Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap
org/apache/commons/collections/MultiMap
java.lang.ClassNotFoundException: org.apache.commons.collections.MultiMap cannot be found by org.jboss.tools.hibernate.runtime.v_5_1_5.0.1.Final-v20160331-1852-B88
org.apache.commons.collections.MultiMap cannot be found   byorg.jboss.tools.hibernate.runtime.v_5_1_5.0.1.Final-v20160331-1852-B88

My maven file:

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
</plugins>
</build>
<dependencies>
<dependency>
    <groupId>org.firebirdsql.jdbc</groupId>
    <artifactId>jaybird-jdk18</artifactId>
    <version>2.2.10</version>
</dependency>
<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-core</artifactId>
   <version>5.1.0.Final</version>
</dependency>
<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.2</version>
</dependency>

I see apache common-collections jar in Maven Dependencies and i am able to use apache's MultiMap in my code.

解决方案

I had the same issue. Here is how I fixed it: Open Edit Configuration dialog and go to Classpath tab, remove project-name (default classpath), click the button "Add Projects..." to add your project. Then it works.

Or you can try using previous version instead of v5.1. In hibernate perspective, "your configuration" / Edit configuration, Change hibernate version to previous version like v4.3.

这篇关于代码生成时无法找到Hibernate MultiMap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆