安装后插件崩溃 - NullPointerException

时间:2015-03-16 17:52:25

标签: eclipse plugins classpath

我在一个单独的Eclipse安装中测试我的插件。我可以创建一个功能并通过更新站点安装它。

但是,当我尝试运行它时,当我从项目中的JAR文件中调用代码时,我从一行中得到一个NullPointerException。

所有必需的JAR都在我的lib文件夹中,我的插件编译得很好。 但是它无法在运行时找到它们,所以我得到了NPE。

以下是我的文件:   - build.properties:

source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
           META-INF/,\
           .,\
           icons/,\
           plugin.properties,\
           templates/,\
           lib/,\
           resources/,\
           lib/asas-base.jar,\
           lib/asas-crypt.jar,\
           lib/asas-dbmssql.jar,\
           lib/asas-dboracle.jar,\
           lib/asas-dbtools.jar,\
           lib/asas-dbtoolsmssql.jar,\
           lib/asas-dbtoolsoracle.jar,\
           lib/asas-jdbc.jar,\
           lib/asas-kernel.jar,\
           lib/asas-rts.jar,\
           lib/asas-sbb.jar,\
           lib/asas-ui.jar
  • MANIFEST.MF文件:

    Bundle-ClassPath: .,
    lib/org.eclipse.e4.xwt_0.9.1.SNAPSHOT.jar,
    lib/org.eclipse.e4.xwt.forms_0.9.1.SNAPSHOT.jar,
    lib/asas-base.jar,
    lib/asas-crypt.jar,
    lib/asas-dbmssql.jar,
    lib/asas-dboracle.jar,
    lib/asas-dbtools.jar,
    lib/asas-dbtoolsmssql.jar,
    lib/asas-dbtoolsoracle.jar,
    lib/asas-jdbc.jar,
    lib/asas-kernel.jar,
    lib/asas-rts.jar,
    lib/asas-sbb.jar,
    lib/asas-ui.jar
    

有什么想法吗? 非常感谢。

这是我得到的堆栈跟踪:

java.lang.NullPointerException
at br.com.senior.wb.asas.model.utils.AsasUtils.createObject(AsasUtils.java:276)
at br.com.senior.wb.asas.model.utils.AsasComponentManager.createComponent(AsasComponentManager.java:11)
at br.com.senior.wb.asas.gef.part.CreateCommand.innerExecute(AsasComponentCommands.java:42)
at br.com.senior.wb.asas.gef.part.CreateCommand$1.run(AsasComponentCommands.java:36)
at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:324)
at br.com.senior.wb.asas.gef.part.CreateCommand.execute(AsasComponentCommands.java:33)
at org.eclipse.wb.internal.gef.core.EditDomain.executeCommand(EditDomain.java:59)
at org.eclipse.wb.gef.core.tools.Tool.executeCommand(Tool.java:209)
at org.eclipse.wb.gef.core.tools.AbstractCreationTool.handleButtonUp(AbstractCreationTool.java:62)
at org.eclipse.wb.gef.core.tools.Tool.mouseUp(Tool.java:395)
at org.eclipse.wb.internal.gef.core.EditDomain.mouseUp(EditDomain.java:255)
at org.eclipse.wb.internal.gef.graphical.EditEventManager.mouseUp(EditEventManager.java:149)
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.wb.internal.draw2d.EventManager$8.invoke(EventManager.java:325)
at com.sun.proxy.$Proxy20.mouseUp(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
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:332)
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:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
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:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

1 个答案:

答案 0 :(得分:0)

我刚刚在这里找到了问题。 问题出在我如何获取plugin.xml文件以从那里读取一些信息。 以下是我修复它的方法:

            InputStream is = FileLocator.openStream(Activator.getDefault().getBundle(), new Path("plugin.xml"), false);
        BufferedReader in = new BufferedReader(new InputStreamReader(is));

没有这个,我的插件无法正常工作。

感谢您的帮助。