Я получаю noclassdeffounderror при попытке создать pojos или отображение с помощью инструментов гибернации
Я пытаюсь сгенерировать pojos из моей базы данных, но я получаю следующие ошибки в eclipse indigo 3.7.2 с установленным плагином hibernate tools 3.4 и библиотеками hibernate 3.6.10 (они, кажется, все) в моем пути сборки
УКОРОЧЕННАЯ ВЕРСИЯ:
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
Мои баночки из buildpath проекта (в порядке, если это имеет значение):
- hibernate-distribution-3.6.10.Final \ hibernate3.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ ANTLR-2.7.6.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ Викисклада коллекции-3.1.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ dom4j-1.6.1.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ Javassist-3.12.0.GA.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ JTA-1.1.jar
- hibernate-distribution-3.6.10.Final \ Lib \ требуется \ SLF4J-апи-1.6.1.jar
- PostgreSQL-9.0-802.jdbc3.jar
Я заметил, что в плагине hibernate tools есть несколько старых jar-файлов в папке с плагинами BTW(например, slf4j версии 1.5.8). А пока попробую загрузку
НОРМАЛЬНАЯ СТОРОНА
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)
В первый раз, когда я попытался использовать генерацию кода, я получил что-то вроде этого:
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
После этого я получил только [...]cfg.reveng.OverrideRepository error
,
3 ответа
После сильных страданий с NoclassDefFoundError for Hours я наконец нашел решение.
Основное внимание: библиотеки версии hibernate должны соответствовать выбранной версии конфигурации консоли Hibernate (пункт 3).
Контрольный список:
Убедитесь, что вы скачали последнюю версию Hibernate Plugin (которая подходит для версии вашего затмения). Чтобы получить его, зайдите в Help->Eclipse Marketplace-> type: hibernate (название версии Eclipse, например, luna). Выберите "Последние инструменты JBoss" и для минимальной функциональности выберите "Hibernate" и "JBoss Maven Hibernate Configurator".
Загрузите последние файлы jar с http://hibernate.org/orm/downloads/. Сохраните эти файлы в папке, которая находится в вашем пути сборки.
При создании конфигурации консоли Hibernate убедитесь, что вы выбрали последнюю версию Hibernate из выпадающего списка. Например, в моем случае, поскольку у меня был Jar-файл Hibernate 4.x в пути сборки, выбрал версию 4.3. решенная проблема.
Попробуйте изменить версии Hibernate из выпадающего списка конфигурации консоли. Это может решить проблему.
Правильный ответ: https://community.jboss.org/thread/201634?tstart=0
Если кому-то есть что добавить, пожалуйста, найдите время и сделайте это, как я.
Спасибо
И кстати, я не могу поверить, что кто-либо в сообществе когда-либо сталкивался с этой ошибкой / проблемой
Я также столкнулся с этой проблемой, работая над реверс-инжинирингом в спящем режиме, и у меня было почти 3 дня, но я наконец-то нашел решение.
Чтобы работать с обратным инжинирингом hibernate, вам не нужно явно добавлять jar, связанный с hibernate, потому что он поставляется вместе с плагинами hibernate tools, только вы должны добавить jar jdbc для соответствующей базы данных.
После создания проекта вы выбираете опцию гибернации в перспективе затмения, а затем выберите
File => New =>Hibernate Console Configuration
Здесь вы должны выполнить настройку консоли Hibernate в том смысле, что у вас есть " Hibernate Version ", убедитесь, что любую выбранную здесь версию вы должны выбрать при создании файла конфигурации Hibernate, который является ничем иным, как hibernate.cfg.xml, если вы сделаете это. то же самое вы не получите эту ошибку:
org.hibernate.console.HibernateConsoleRuntimeException: получено NoClassDefFoundError, возможно, путь к классу конфигурации консоли неполон или содержит конфликтующие версии того же класса