Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate MultiMap cannot be found while code generation

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.

like image 635
clsbartek Avatar asked Apr 24 '16 19:04

clsbartek


2 Answers

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.

like image 153
Gordon Ma Avatar answered Oct 17 '22 02:10

Gordon Ma


Just to chime in: Eclipse Mars. Hibernate 5.1.0. JDK 8. As Gordon and Kevin mentioned above, changing the version of Hibernate to 4.3 in in Edit Configuration worked for me.

like image 43
Hodglem Avatar answered Oct 17 '22 00:10

Hodglem