4

I'm trying to generate pojos from my database but I get the following error(s) on eclipse indigo 3.7.2 with hibernate tools 3.4 plugin installed and hibernate 3.6.10 libraries (they seem to be all) in my build path

SHORT VERSION :

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: Could not initialize class org.hibernate.cfg.reveng.OverrideRepository
  Could not initialize class org.hibernate.cfg.reveng.OverrideRepository
    java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.reveng.OverrideRepository
    Could not initialize class org.hibernate.cfg.reveng.OverrideRepository

MY jars from the project buildpath are ( in order if that matters):

  • hibernate-distribution-3.6.10.Final\hibernate3.jar
  • hibernate-distribution-3.6.10.Final\lib\required\antlr-2.7.6.jar
  • hibernate-distribution-3.6.10.Final\lib\required\commons-collections-3.1.jar
  • hibernate-distribution-3.6.10.Final\lib\required\dom4j-1.6.1.jar
  • hibernate-distribution-3.6.10.Final\lib\required\javassist-3.12.0.GA.jar
  • hibernate-distribution-3.6.10.Final\lib\required\jta-1.1.jar
  • hibernate-distribution-3.6.10.Final\lib\required\slf4j-api-1.6.1.jar
  • postgresql-9.0-802.jdbc3.jar

I noticed that hibernate tools plugin has a few older jars in its plugins folder BTW( slf4j for example being version 1.5.8) In the meantime I will try buddyloading

NORMAL STACKTRACE

ENTRY org.hibernate.eclipse.console 4 666 2012-06-25 04:23:55.946
!MESSAGE org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
!STACK 0
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:854)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
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
!SUBENTRY 1 org.hibernate.eclipse.console 4 666 2012-06-25 04:23:55.946
!MESSAGE org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
!STACK 0
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:854)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
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
!SUBENTRY 1 org.hibernate.eclipse.console 4 666 2012-06-25 04:23:55.946
!MESSAGE java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.reveng.OverrideRepository
!STACK 0
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)
    at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:270)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)  

The first time i tried to use code generation i got something like this :

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/objectweb/asm/Type   org/objectweb/asm/Type    
java.lang.NoClassDefFoundError: org/objectweb/asm/Type org/objectweb/asm/Type          
java.lang.ClassNotFoundException: org.objectweb.asm.Type     org.objectweb.asm.Type    

After that i got only the [...]cfg.reveng.OverrideRepository error.

apaderno
  • 28,547
  • 16
  • 75
  • 90
geogeorge
  • 141
  • 1
  • 3
  • 7

3 Answers3

6

After badly suffering with NoclassDefFoundError for Hours, I finally found the solution.

Main focus: The libraries of hibernate version should match with selected Hibernate version of console configuration(point 3).

Check List:

  1. Make sure you have downloaded latest version of Hibernate Plugin (That suits your eclipse's version). For getting it go to Help->Eclipse Marketplace-> type: hibernate (eclipse version name e.g. luna). Select Latest JBoss Tools and for minimum functionality select Hibernate and JBoss Maven Hibernate Configurator.

  2. Download latest jar files from http://hibernate.org/orm/downloads/. Store those files in folder that is there in your build path.

  3. When creating Hibernate console configuration make sure you select latest Hibernate Version from drop down. e.g. In my case as I had Hibernate 4.x jar file in build path, choosing version 4.3. solved problem.

Try changing Hibernate versions from drop down list of console configuration. It may fix the problem.

Dhwaneel
  • 541
  • 5
  • 8
  • 2
    The version change trick solved my issue. I am on Eclipse Mars + Hibernate Tools 5.0.1.Final-v20160331-1852-B88. So, i was using Version 5.0 on the Launch Configuration. I was getting NoClassDefFound for MultiMap class. changing the version to 4.3 solved it. – Prasanna Mondkar Jul 06 '16 at 12:12
3

Correct answer: https://community.jboss.org/thread/201634?tstart=0
If anyone has anything to add please take the time and do it, as i have.

Thanks

And BTW i can't believe anybody in the community ever encountered this error/ problem

geogeorge
  • 141
  • 1
  • 3
  • 7
-2

I also faced this issue while working on hibernate reverse engineering and I suffered almost 3 days, but I finally got the solution.

  1. In order to work on the hibernate reverse engineering you don't need to add any hibernate related jar explicitly because it comes along with the hibernate tools plugins, only the thing is you have to add the jdbc jar for the corresponding Database.

  2. After creating the project you are selecting hibernate option in the perspective of eclipse then you will select File => New =>Hibernate Console Configuration

  3. Here you have to do hibernate console configuration in that you have "Hibernate Version" make sure what ever version you have selected here the same you have to select while creating the Hibernate Configuration File which is nothing but hibernate.cfg.xml if you will do the same you won't get this error:

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

Supamiu
  • 8,501
  • 7
  • 42
  • 76