Bug 579293 - NoSuchElementException when running launch configurations from Eclipse <= 4.22
Summary: NoSuchElementException when running launch configurations from Eclipse <= 4.22
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.23   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-17 06:30 EDT by Benjamin Brandl CLA
Modified: 2022-07-04 04:29 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Brandl CLA 2022-03-17 06:30:26 EDT
Since the update to Eclipse 4.23 launch configurations from previous Eclipse versions fail to start. The error log shows following exception:
```
java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377)
	at org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper.getSelectedModels(BundleLauncherHelper.java:409)
	at org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper.getBundleMap(BundleLauncherHelper.java:391)
	at org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper.getWorkspaceBundleMap(BundleLauncherHelper.java:354)
	at org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper.getWorkspaceBundleMap(BundleLauncherHelper.java:69)
	at org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator.getSelectedWorkspacePlugins(LaunchPluginValidator.java:42)
	at org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator.getAffectedProjects(LaunchPluginValidator.java:63)
	at org.eclipse.pde.internal.launching.launcher.LaunchPluginValidator.getAffectedProjects(LaunchPluginValidator.java:51)
	at org.eclipse.pde.launching.AbstractPDELaunchConfiguration.getBuildOrder(AbstractPDELaunchConfiguration.java:422)
	at org.eclipse.debug.core.model.LaunchConfigurationDelegate.saveBeforeLaunch(LaunchConfigurationDelegate.java:244)
	at org.eclipse.debug.core.model.LaunchConfigurationDelegate.preLaunchCheck(LaunchConfigurationDelegate.java:197)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:767)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:716)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

```
Comment 1 Wim Jongman CLA 2022-03-17 06:38:39 EDT
Benjamin, that could be if you use bundles from the running platform or mix bundles from your current target platform with the new running platform. Please inspect your target platforms and the bundles used in your run configuration.

Run configurations are not automatically compatible.
Comment 2 Benjamin Brandl CLA 2022-03-17 07:09:47 EDT
There's a designated target platform which should not interfere with the running one. The launch configuration is containing no additional bundles, but only features defined in the workspace.
Comment 3 Wim Jongman CLA 2022-03-17 07:48:27 EDT
Did you try to clean your runtime workspace and runtime configuration area?
Comment 4 Benjamin Brandl CLA 2022-03-17 08:05:10 EDT
Haven't tried that before. However the exception is thrown before the cleaning confirmation dialog is able to pop up.
Comment 5 Wim Jongman CLA 2022-03-17 08:10:00 EDT
(In reply to Benjamin Brandl from comment #4)
> Haven't tried that before. However the exception is thrown before the
> cleaning confirmation dialog is able to pop up.

I see, maybe your eclipse is stale. Please try to run your eclipse with 

eclipse.exe -clean

To also reset the UI model you can run with

eclipse.exe -clearPersistedState
Comment 6 Benjamin Brandl CLA 2022-03-17 08:26:20 EDT
Unfortunately both arguments don't have an effect. Previous launch configuration fail to run the underlying product.

My workaround is to recreate the configurations. So it's only a backwards compatibility issue. Still, I'm a little bit surprised as I haven't seen such thing in years.

Interestingly the issue didn't appear in 4.23 milestones and release candidates. It only appeared in the released version, here in the updated instance as well as in an new one.
Comment 7 Benjamin Brandl CLA 2022-03-17 08:41:59 EDT
I've compared the newly create launch configuration with a failing one: The new one doesn't have the `setAttribute` `selected_target_bundles` and `select_workspace_bundles`. 

If I remove the `<setAttribute key="select_workspace_bundles">` from a failing configuration, it will start again.

So that's what the `BundleLauncherHelper.getWorkspaceBundleMap` in the stack trace is referring to.
Comment 8 Kenneth Styrberg CLA 2022-07-04 04:29:11 EDT
I bumped into this one also. After some testing I found out that some plugins lacked "@default:default" in the <setEntry> tag.
After adding that the application started normal.