This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 417416 - [Perspectives] [regression] NPE when running 3.x RCP applications
Summary: [Perspectives] [regression] NPE when running 3.x RCP applications
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.4 M2   Edit
Assignee: Daniel Rolka CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard:
Keywords:
Depends on: 412121
Blocks:
  Show dependency tree
 
Reported: 2013-09-17 07:53 EDT by Daniel Rolka CLA
Modified: 2014-06-04 05:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Rolka CLA 2013-09-17 07:53:07 EDT
Steps to reproduce the issue:

1) Create new 3.x application from template (i.e. the application with an intro or the mail one)

2) Run the application with the PDE launcher

3) The following exception is thrown during running the application:

!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:84)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:73)
	at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1399)
	at org.eclipse.ui.internal.Workbench.getActiveWorkbenchWindow(Workbench.java:1372)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.updateActiveShell(WorkbenchSourceProvider.java:924)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.getCurrentState(WorkbenchSourceProvider.java:133)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider$6.handleEvent(WorkbenchSourceProvider.java:684)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1082)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1067)
	at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1667)
	at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2151)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4608)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2075)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5001)
	at org.eclipse.swt.internal.win32.OS.BringWindowToTop(Native Method)
	at org.eclipse.swt.widgets.Decorations.bringToTop(Decorations.java:231)
	at org.eclipse.swt.widgets.Shell.open(Shell.java:1217)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.postProcess(WBWRenderer.java:675)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:649)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1038)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:144)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:613)
	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 test3.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:109)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:80)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:372)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:226)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	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)
Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3938)
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:658)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 53 more
Comment 1 Daniel Rolka CLA 2013-09-17 07:54:18 EDT
Before the exception is thrown the following errors related to the EventAdmin service are reported to the log:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.692
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/PartDescriptorContainer/descriptors/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.698
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/PartDescriptorContainer/descriptors/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.701
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UILabel/label/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.703
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/PartDescriptor/category/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.705
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.707
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/PartDescriptor/closeable/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.709
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/PartDescriptor/contributionURI/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.717
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UILabel/iconURI/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.720
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.939
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/Context/context/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.966
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/renderer/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.971
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:03.980
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/widget/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.056
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/persistedState/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.059
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/persistedState/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.088
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/persistedState/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.119
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/Window/sharedElements/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.125
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.131
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.135
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/TrimmedWindow/trimBars/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.137
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/elementId/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.139
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.148
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/transientData/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.152
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.156
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.158
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.160
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.163
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.169
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.173
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/visible/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.177
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/TrimmedWindow/trimBars/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.179
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.181
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.184
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.186
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.189
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.191
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.193
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/toBeRendered/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.196
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/TrimmedWindow/trimBars/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.198
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/TrimmedWindow/trimBars/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.211
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/Window/mainMenu/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.214
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/renderer/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.219
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/widget/SET].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.226
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/basic/Window/sharedElements/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.231
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD].

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-09-17 13:45:04.233
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET].

!ENTRY org.eclipse.e4.ui.workbench.swt 4 2 2013-09-17 13:45:04.237
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench.swt".
!STACK 0
Comment 2 Daniel Rolka CLA 2013-09-17 07:54:41 EDT
The 4.x RCP applications work fine
Comment 3 Daniel Rolka CLA 2013-09-17 08:23:13 EDT
found in build: I20130916-2330
Comment 4 Daniel Rolka CLA 2013-09-17 09:02:39 EDT
I've made quick look at the code and it looks that for some reasons the 'org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET' event is not propagated after processing the line 3936 in the WorkbenchPage class:

WorkbenchPage.setPerspective(IPerspectiveDescriptor perspective)
  ...
  // activate it
  perspectives.setSelectedElement(modelPerspective);
  ...
}

and the MPerspective.context is not set for the 'modelPerspective' variable what causes to the NPE in the line 3938 (modelPerspective.getContext().activate())

Daniel
Comment 5 Paul Webster CLA 2013-09-17 15:15:27 EDT
Daniel, can you continue looking at this when you get in?

PW
Comment 6 Daniel Rolka CLA 2013-09-18 06:04:08 EDT
The issue is caused by the change introduced in the bug 412121 that relies on removing dependency to the org.eclipse.equinox.event bundle. 
Missing dependency breaks the EventBroker that refers to the EventAdmin service by calling the org.eclipse.e4.ui.internal.services.Activator.getDefault().getEventAdmin() method. Finally the EventAdmin service is not found and events are not supported

I'm going to prepare the patch that will revert temporarily this change and we can go through the issue reported with the bug 412121 once again when the M2 will be released

Daniel
Comment 7 Daniel Rolka CLA 2013-09-18 06:17:47 EDT
Gerrit review link: https://git.eclipse.org/r/#/c/16544/

Daniel
Comment 8 Brian de Alwis CLA 2013-09-18 09:38:00 EDT
I don't think this is the right fix — it defeats the the point of bug 412121 which is to untie us from a dependency on Equinox's EventAdmin.
Comment 9 Paul Webster CLA 2013-09-18 09:50:23 EDT
(In reply to Brian de Alwis from comment #8)
> I don't think this is the right fix — it defeats the the point of bug 412121
> which is to untie us from a dependency on Equinox's EventAdmin.

It needs to be fixed today, as this will block our M2.  If there's another idea I'm open to it.

PW
Comment 11 Paul Webster CLA 2013-09-18 09:54:53 EDT
Good catch, Daniel.  Thanks.

You're right, Brian, we'll need to revisit bug 412121 

PW
Comment 12 Daniel Rolka CLA 2014-06-04 05:15:06 EDT
Verified in the build: 4.4RC3

Daniel