Exception while trying to run eclipse product

2020-02-11 08:40发布

问题:

I got the below exception while trying to run an eclipse product which exported without errors

java.lang.NullPointerException
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.<init>

any clue?

Full stack trace:

!SESSION 2013-07-23 02:08:52.676 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2013-07-23 02:08:54.202
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.<init>(ModelServiceImpl.java:124)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:471)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:199)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:581)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at myapp.MyApp.start(MyApp.java:20)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

回答1:

I had the same problem after updating my Eclipse 3.7 application to 4.3. The solution was to replace the contents of the tag in my product file with the following:

<configurations>
   <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="2" />
   <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="3" />
   <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="3" />
</configurations>

Also see http://wiki.eclipse.org/Eclipse4/RCP/FAQ#Why_won.27t_my_application_start.3F



回答2:

Try removing spaces in your debug configuration names.

I'm pretty reluctant to write this here as I know it sounds crazy and I have no proof/explanation whatsoever. But here is my story.
I was translating my eclipse java application (RCP) and had 2 debug launch configurations. One to launch in Dutch and 1 to launch in English.
All of a sudden these stopped working with the stack trace like above.
I started undoing changes, but to no avail.
Internet search lead me here but the changes proposed by the accepted answer didn't help my case.
Then I created a new launch configuration by clicking the debug icon in the product manifest.
That one worked. Checking the differences in the launch configuration files showed no differences except for the config name and location. Being a C/C++ guy I removed the spaces in the config name in the gui and bang it started working again :-s
The weird thing is that both configs contained spaces and by removing the spaces in one of them, they both started working. As it took me way over 4 hours to fix this I thought I'd share this.



回答3:

You can edit your congif.ini

before:

osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@start

after:

osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.equinox.ds@2:start,org.eclipse.core.runtime@start