Is connected mode used: Trying to get connected to a SonarQube server
I’m trying to connect the latest Eclipse IDE for Java EE developers with the latest version of the SonarQube for IDE plugin to a Enterprise Edition Version 10.4.1 (build 88267) SonarQube server. I have tried multiple tokens, and have tried generating them manually in the browser first or letting the connection wizard create one for me. But either way, when I click “Finish” on the last step of the process I get the following error: “Cannot create connection: Key not valid for use in specified state.” and the window will not close. The only way out is to click “Cancel” and then the connection is not created. I have attached a screenshot too.
Do you reproduce the same on the previous version of the extension? The error message key not valid for use in specified state seems to be related to Windows password encryption
Please also kindly provide logs, just to make sure we don’t miss something obvious
Thank you for the hint about being related to windows password encryption. With that and another post I found online, I was able to track the issue down. In case it helps anyone else, the issue was that I had migrated PCs and my ~/.eclipse/org.eclipse.equinox.security directory, which contains a secure_storage file, had been copied from the other PC. The old file was incompatible with the new PC installation and was causing the following stack trace in the SonarLint console:
Error when finishing connection wizard
com.sun.jna.platform.win32.Win32Exception: Key not valid for use in specified state.
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:172)
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:146)
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:133)
at org.eclipse.equinox.internal.security.win32.WindowsPasswordProvider.windecrypt(WindowsPasswordProvider.java:41)
at org.eclipse.equinox.internal.security.win32.WindowsPasswordProvider.getPassword(WindowsPasswordProvider.java:68)
at org.eclipse.equinox.internal.security.storage.PasswordProviderModuleExt.getPassword(PasswordProviderModuleExt.java:44)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getModulePassword(SecurePreferencesRoot.java:257)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getPassword(SecurePreferencesRoot.java:217)
at org.eclipse.equinox.internal.security.storage.SecurePreferences.put(SecurePreferences.java:230)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesWrapper.put(SecurePreferencesWrapper.java:128)
at org.sonarlint.eclipse.core.internal.engine.connected.ConnectionManager.storeCredentials(ConnectionManager.java:277)
at org.sonarlint.eclipse.core.internal.engine.connected.ConnectionManager.addConnection(ConnectionManager.java:261)
at org.sonarlint.eclipse.ui.internal.binding.wizard.connection.AbstractConnectionWizard.finalizeConnectionCreation(AbstractConnectionWizard.java:137)
at org.sonarlint.eclipse.ui.internal.binding.wizard.connection.ServerConnectionWizard.actualPerformFinish(ServerConnectionWizard.java:214)
at org.sonarlint.eclipse.ui.internal.binding.wizard.connection.AbstractConnectionWizard.performFinish(AbstractConnectionWizard.java:118)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:837)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:474)
at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:265)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4404)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1173)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4202)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3790)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:663)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:570)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
I deleted the .eclipse directory, restarted eclipse, and was then able to successfully link up to our SonarQube server in connected mode. Thanks!