当前位置: 首页 > 知识库问答 >
问题:

java.lang.NoClassDefoundError:org/apache/poi/xssf/usermodel/xssfworkbook

方祺
2023-03-14

我得到了这个例外,但我不能理解那里发生了什么。

因为在编译时,我的类可以访问apache POI类,但在运行时,我的类抛出异常,他无法找到

org.apache.poi.xssf.usermodel.xssfworkbook

如果你有什么建议,请分享。

我得到以下异常。

!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
    at com.herzog.pmide.mergedconfigxml.ui.editors.DocumentGenerator.prepareScadaIOListExcel(DocumentGenerator.java:94)
    at com.herzog.pmide.mergedconfigxml.ui.editors.DocumentGenerator.scadaIOList(DocumentGenerator.java:77)
    at com.herzog.pmide.mergedconfigxml.ui.actions.DocumentGeneratorAction.run(DocumentGeneratorAction.java:47)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:331)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:331)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at com.herzog.pmide.application.Application.start(Application.java:20)
    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(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook cannot be found by com.herzog.pmide.mergedconfigxml.ui_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Manifest.MF如下

    Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ui
Bundle-SymbolicName: com.herzog.pmide.mergedconfigxml.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.herzog.pmide.mergedconfigxml.ui.Activator
Bundle-Vendor: Example
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.core.resources,
 org.eclipse.emf.ecore.xmi,
 org.eclipse.emf.edit.ui,
 com.herzog.pmide.machinelib.model.edit,
 org.eclipse.ui.forms,
 org.eclipse.ui.workbench,
 org.eclipse.ui.ide,
 com.herzog.pmide.mergedconfigxml.model.edit,
 org.eclipse.gef,
 com.herzog.pmide.tools.importutility,
 com.herzog.pmide.machinelib.model,
 org.eclipse.swt,
 org.eclipse.emf.query,
 com.herzog.pmide.mergedconfigxml.model,
 org.eclipse.ui.editors,
 org.eclipse.emf.validation,
 org.eclipse.emf.validation.ui,
 org.slf4j.api,
 org.junit,
 org.eclipse.emf.compare,
 org.eclipse.emf.compare.edit,
 org.eclipse.emf.compare.ide.ui,
 org.eclipse.compare,
 org.apache.commons.io,
 org.eclipse.core.filesystem,
 de.vonloesch.pdf4Eclipse,
 de.vonloesch.pdf4eclipse.help,
 com.herzog.pmide.routingline.model
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Export-Package: com.herzog.pmide.mergedconfigxml.ui,
 com.herzog.pmide.mergedconfigxml.ui.editors.unitconfig,
 com.herzog.pmide.mergedconfigxml.ui.views
Bundle-Localization: OSGI-INF/l10n/message
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.xml,\
               icons/,\
               OSGI-INF/l10n/message.properties

共有1个答案

商勇
2023-03-14

插件只能访问其他插件中的类,或者插件中包含的JAR中的类,这些类包含在bundle类路径中。设置Java构建路径属性不会正确配置插件。

将您需要的所有JAR添加到插件中,通常这些JAR都放在'lib'目录中。

更新build.properties以将这些JAR包含在“bin.includes”部分中。例如:

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.properties,\
               plugin.xml,\
               lib/,\
               lib/jogg-0.0.7.jar,\
               lib/jorbis-0.0.15.jar,\
               lib/vorbisspi1.0.2.jar
Bundle-ClassPath: .,
 lib/jogg-0.0.7.jar,
 lib/jorbis-0.0.15.jar,
 lib/vorbisspi1.0.2.jar
 类似资料:
  • 我正在尝试从资产文件夹读取xlsx文件。我收到以下例外情况, 05-16 10:12:05.613:E/AndroidRuntime(2915):致命异常:main 05-16 10:12:05.613:E/AndroidRuntime(2915):java.lang.VerifyError:org/apache/poi/xssf/usermodel/xssfworkbook 在此异常之前,我还收

  • HSSF是POI项目的Excel'97(-2007)文件格式的纯Java实现。XSSF是POI项目对Excel2007OOXML(.xlsx)文件格式的纯Java实现。 使用HSSF时是否有出口限制?

  • 问题内容: 我制作了一个小型应用程序,可以从excel(xls文件)中读取内容并将其内容显示到JTable中。在eclipse中一切正常,但是当我创建jar文件并尝试运行它时,出现以下问题: 我发现奇怪的是,问题出在行上,当在行之前调用Workbook和Sheet时,它没有任何麻烦(至少从我的观察中可以看出)。 我已经研究了很多,主要似乎是jar文件不在Class-Path中,但是打开jar和清单

  • 我正在使用ApachePOI读取一些Excel文件。我创建了一个控制台应用程序来完成这项工作,之后我尝试将代码集成到SpringMVCwebapp中(我知道没什么特别的)。我已将相同的Jar文件包含到我的类路径中,但每当我尝试运行代码时,都会出现以下错误: 我相信类Font是在编译时找到的,但不是在运行时。我很确定问题不在于ClassPath,但是我不知道如何解决这个问题。 编辑:当我用main方

  • 我制作了一个小应用程序,它从excel(xls文件)读取内容并将内容显示到JTable。eclipse中的一切都很好,但是当我创建jar文件并尝试运行它时,我遇到了以下问题: 我发现的奇怪的事情是,问题是行,当工作簿和工作表被称为行之前,并没有给任何麻烦(至少从我可以看到)。 我已经研究了很多,主要似乎是jar文件不在类路径中,但是打开jar和清单文件,我可以看到所有的jar都存在。 这就是我的p