休眠 java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap

Posted

技术标签:

【中文标题】休眠 java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap【英文标题】:Hibernate java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap 【发布时间】:2016-09-03 23:04:55 【问题描述】:

每次我尝试刷新 Hibernate 逆向工程文件的数据库方案时,都会收到未处理的事件循环异常:

Hibernate Reverse Engineering File

java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:41)
at org.jboss.tools.hibernate.runtime.common.AbstractOverrideRepositoryFacade.addTableFilter(AbstractOverrideRepositoryFacade.java:31)
at org.hibernate.eclipse.mapper.editors.ReverseEngineeringEditor.getLazyDatabaseSchema(ReverseEngineeringEditor.java:219)
at org.hibernate.eclipse.mapper.editors.reveng.TypeMappingFormPart$1.doRefreshTree(TypeMappingFormPart.java:57)
at org.hibernate.eclipse.console.wizards.TreeToTableComposite$6.widgetSelected(TreeToTableComposite.java:400)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
Caused by: 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
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 37 more

但是,我将 commons-collections-3.2.2.jar 和 commons-collections-3.2.2-javadoc.jar 放在 Build Path 中,所以在 WebContent/WEB-INF/lib 中:Project Explorer

有人知道如何解决这个问题吗?

【问题讨论】:

有同样的问题。尝试卸载并重新安装插件。类似于***.com/questions/36827726/…,但答案不起作用。它正在hibernate.atlassian.net/browse/HBX-1256 进行跟踪 【参考方案1】:

我已经通过 Hibernate Console Configuration 将 hibernate 版本降级到 4.3 并创建了配置(Hibernate Perspective - Run Hibernate - Hibernate Code Generation Configuration),它开始工作了。

【讨论】:

好吧终于找到了。只需右键单击并在休眠透视图中“编辑配置”

以上是关于休眠 java.lang.NoClassDefFoundError: org/apache/commons/collections/MultiMap的主要内容,如果未能解决你的问题,请参考以下文章

Log4j2/Slf4j 和 Java 11

windows10下使用spark-2.3.0-bin-without-hadoop相关问题

电脑休眠怎么唤醒?

求助,Windows 2008如何配置睡眠(Sleep)、休眠(hibernate)、混合休眠(Hybird Sleep)、标准睡眠(Standby)

vmware黑群晖硬盘休眠

休眠文件瘦身教程 Win10休眠文件怎么清