Most irritating bug of my life

Maybe not the worst I’ve seen, but it’s in the top 10, definitely. As I was unable to find any help on the Internet, it might help someone someday, so here it goes.

Currently, I’m working on an RCP + Spring + OSGI project. After a large-scale integration, I was getting the following exception at startup:

!ENTRY org.eclipse.ui 4 0 2011-08-10 10:46:59.838
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
        at org.eclipse.ui.internal.handlers.HandlerProxy.loadHandler(HandlerProxy.java:352)
        at org.eclipse.ui.internal.handlers.HandlerProxy.setEnabled(HandlerProxy.java:231)
        at org.eclipse.core.commands.Command.setEnabled(Command.java:857)
        at org.eclipse.ui.menus.CommandContributionItem.isEnabled(CommandContributionItem.java:918)
        at org.eclipse.ui.menus.CommandContributionItem.updateToolItem(CommandContributionItem.java:611)
        at org.eclipse.ui.menus.CommandContributionItem.update(CommandContributionItem.java:528)
        at org.eclipse.ui.menus.CommandContributionItem.fill(CommandContributionItem.java:503)
        at org.eclipse.jface.action.ToolBarManager.update(ToolBarManager.java:353)
        at org.eclipse.jface.action.ToolBarManager.createControl(ToolBarManager.java:111)
        at org.eclipse.jface.action.ToolBarContributionItem.fill(ToolBarContributionItem.java:192)
        at org.eclipse.jface.action.CoolBarManager.update(CoolBarManager.java:928)
        at org.eclipse.jface.action.CoolBarManager.createControl(CoolBarManager.java:247)
        at org.eclipse.jface.internal.provisional.action.CoolBarManager2.createControl2(CoolBarManager2.java:76)
        at org.eclipse.jface.window.ApplicationWindow.createCoolBarControl(ApplicationWindow.java:523)
        at org.eclipse.ui.internal.WorkbenchWindow.createDefaultContents(WorkbenchWindow.java:1053)
        at org.eclipse.ui.internal.WorkbenchWindowConfigurer.createDefaultContents(WorkbenchWindowConfigurer.java:625)
        at org.eclipse.ui.application.WorkbenchWindowAdvisor.createWindowContents(WorkbenchWindowAdvisor.java:268)
        at org.eclipse.ui.internal.WorkbenchWindow.createContents(WorkbenchWindow.java:1000)
        at org.eclipse.jface.window.Window.create(Window.java:431)
        at org.eclipse.ui.internal.Workbench$20.runWithException(Workbench.java:1032)
        at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3885)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3506)
        at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
        at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
        at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3885)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3506)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(Application.java:60)
        at xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(Application.java:36)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
        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:368)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        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:559)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Not that self explanatory, is it? After a week of try-error cycles, it turned out that Spring’s configuration.xml was missing a bean (thank you, automatic merge…), so Spring context was unable to start up. It has thrown an exception that was caught by the RCP framework. After correcting the XML file, the application magically got well… I wish these frameworks could work together and give valuable error messages…
Advertisements

Author: tamasgyorfi

Senior software engineer, certified enterprise architect and certified Scrum master. Feel free to connect on Twitter: @tamasgyorfi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s