天天看點

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

場景:

項目需要使用Sonarlint進行代碼檢查,以前一直沒注意使用,今天想用下,發現根本用不了

問題描述:

報錯主要有3個分别如下:

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

 報錯内容如下:

failed to init toolwindow org.sonarlint.intellij.ui.SonarLintToolWindowFactory

java.lang.IllegalStateException: java.nio.file.InvalidPathException: Illegal char <*> at index 0: *:\app\nodejs\node.exe
	at org.sonarlint.intellij.core.SonarLintEngineFactory.createEngine(SonarLintEngineFactory.java:107)
	at org.sonarlint.intellij.core.SonarLintEngineManager.getStandaloneEngine(SonarLintEngineManager.java:129)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:86)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:67)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.isExcludedInServer(AutoTriggerStatusPanel.java:137)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.getCard(AutoTriggerStatusPanel.java:126)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.switchCards(AutoTriggerStatusPanel.java:103)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.<init>(AutoTriggerStatusPanel.java:77)
	at org.sonarlint.intellij.ui.SonarLintIssuesPanel.<init>(SonarLintIssuesPanel.java:55)
	at org.sonarlint.intellij.ui.SonarLintToolWindowFactory.addIssuesTab(SonarLintToolWindowFactory.java:67)
	at org.sonarlint.intellij.ui.SonarLintToolWindowFactory.createToolWindowContent(SonarLintToolWindowFactory.java:51)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.ensureContentInitialized(ToolWindowImpl.java:533)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.lambda$initToolWindow$10(ToolWindowManagerImpl.java:508)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindow(ToolWindowManagerImpl.java:511)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$6.run(ToolWindowManagerImpl.java:463)
	at com.intellij.openapi.wm.impl.CommandProcessor.runNext(CommandProcessor.java:78)
	at com.intellij.openapi.wm.impl.CommandProcessor.run(CommandProcessor.java:59)
	at com.intellij.openapi.wm.impl.commands.FinalizableCommand.finish(FinalizableCommand.java:36)
	at com.intellij.openapi.wm.impl.ToolWindowsPane$AddToolStripeButtonCmd.run(ToolWindowsPane.java:984)
	at com.intellij.openapi.wm.impl.CommandProcessor.runNext(CommandProcessor.java:78)
	at com.intellij.openapi.wm.impl.CommandProcessor.run(CommandProcessor.java:59)
	at com.intellij.openapi.wm.impl.commands.FinalizableCommand.finish(FinalizableCommand.java:36)
	at com.intellij.openapi.wm.impl.ToolWindowsPane$AddToolStripeButtonCmd.run(ToolWindowsPane.java:984)
	at com.intellij.openapi.wm.impl.CommandProcessor.runNext(CommandProcessor.java:78)
	at com.intellij.openapi.wm.impl.CommandProcessor.run(CommandProcessor.java:59)
	at com.intellij.openapi.wm.impl.CommandProcessor.flush(CommandProcessor.java:32)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.flushCommands(ToolWindowManagerImpl.java:596)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.access$3100(ToolWindowManagerImpl.java:74)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$InitToolWindowsActivity.lambda$runActivity$0(ToolWindowManagerImpl.java:2344)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:878)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:827)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:466)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:465)
	at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:935)
	at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:205)
	at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:191)
	at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:566)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:459)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:82)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:256)
	at com.intellij.platform.PlatformProjectOpenProcessor.doOpenProject(PlatformProjectOpenProcessor.java:199)
	at com.intellij.ide.RecentProjectsManagerBase.doOpenProject(RecentProjectsManagerBase.java:508)
	at com.intellij.ide.RecentProjectsManagerBase.doReopenLastProject(RecentProjectsManagerBase.java:636)
	at com.intellij.ide.RecentProjectsManagerBase.reopenLastProjectOnStart(RecentProjectsManagerBase.java:614)
	at com.intellij.idea.IdeaApplication$IdeStarter.lambda$main$1(IdeaApplication.java:410)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:82)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:106)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:115)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
	at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:402)
	at com.intellij.idea.IdeaApplication.lambda$null$3(IdeaApplication.java:154)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:192)
	at com.intellij.idea.IdeaApplication.lambda$executeInitAppInEdt$5(IdeaApplication.java:154)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:438)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.nio.file.InvalidPathException: Illegal char <*> at index 0: *:\app\nodejs\node.exe
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at org.sonarsource.sonarlint.core.NodeJsHelper.locateNode(NodeJsHelper.java:111)
	at org.sonarsource.sonarlint.core.NodeJsHelper.detect(NodeJsHelper.java:62)
	at org.sonarlint.intellij.core.NodeJsManager.initNodeIfNeeded(NodeJsManager.java:62)
	at org.sonarlint.intellij.core.NodeJsManager.getNodeJsPath(NodeJsManager.java:70)
	at org.sonarlint.intellij.core.SonarLintEngineFactory.createEngine(SonarLintEngineFactory.java:102)
	... 74 more           
java.lang.IllegalStateException: java.nio.file.InvalidPathException: Illegal char <*> at index 0: *:\app\nodejs\node.exe
	at org.sonarlint.intellij.core.SonarLintEngineFactory.createEngine(SonarLintEngineFactory.java:107)
	at org.sonarlint.intellij.core.SonarLintEngineManager.getStandaloneEngine(SonarLintEngineManager.java:129)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:86)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:67)
	at org.sonarlint.intellij.trigger.SonarLintSubmitter.filterWithServerExclusions(SonarLintSubmitter.java:178)
	at org.sonarlint.intellij.trigger.SonarLintSubmitter.filterAndGetByModule(SonarLintSubmitter.java:170)
	at org.sonarlint.intellij.trigger.SonarLintSubmitter.submitFiles(SonarLintSubmitter.java:126)
	at org.sonarlint.intellij.trigger.SonarLintSubmitter.submitFiles(SonarLintSubmitter.java:119)
	at org.sonarlint.intellij.trigger.EditorOpenTrigger.runActivity(EditorOpenTrigger.java:67)
	at com.intellij.ide.startup.impl.StartupManagerImpl.runActivity(StartupManagerImpl.java:205)
	at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$null$1(StartupManagerImpl.java:181)
	at com.intellij.openapi.project.DumbServiceImpl.doRun(DumbServiceImpl.java:389)
	at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:381)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:82)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:67)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:878)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:827)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:466)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:465)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.nio.file.InvalidPathException: Illegal char <*> at index 0: *:\app\nodejs\node.exe
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at org.sonarsource.sonarlint.core.NodeJsHelper.locateNode(NodeJsHelper.java:111)
	at org.sonarsource.sonarlint.core.NodeJsHelper.detect(NodeJsHelper.java:62)
	at org.sonarlint.intellij.core.NodeJsManager.initNodeIfNeeded(NodeJsManager.java:62)
	at org.sonarlint.intellij.core.NodeJsManager.getNodeJsPath(NodeJsManager.java:70)
	at org.sonarlint.intellij.core.SonarLintEngineFactory.createEngine(SonarLintEngineFactory.java:102)
	... 35 more           
java.lang.NullPointerException
	at org.sonarlint.intellij.actions.SonarLintToolWindow.populateTaintVulnerabilitiesTab(SonarLintToolWindow.java:114)
	at org.sonarlint.intellij.issue.vulnerabilities.TaintVulnerabilitiesPresenter$presentTaintVulnerabilitiesForOpenFiles$1$run$1.run(TaintVulnerabilitiesPresenter.kt:100)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:312)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:878)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:827)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:466)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:465)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)           

百度了下 也沒找到答案,有一個文章說要版本一緻都要jdk1.8 更新idea ,可我的idea版本也不舊啊,idea版本

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:
Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

原因分析:

idea線上安裝的這個不好用 試試離線安裝的

打開idea的插件市場找到 SonarLint

SonarLint - IntelliJ IDEs Plugin | Marketplace

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

從這個截圖也能看出來 我的idea版本2019.2最高也就能安裝這個 4.142.28348 沒問題

問了同僚 他的idea版本是2019.1的也是安裝的這個 4.142.28348可以正常使用

下載下傳安裝包

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

離線安裝試試

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

settings -> plugins -> install plugin from disk,然後重新開機IDEA 仍然沒什麼效果  和市場安裝的問題一樣

還是再分析分析吧 看報錯提示

java.lang.IllegalStateException: java.nio.file.InvalidPathException: Illegal char <*> at index 0: *:\app\nodejs\node.exe

問題可能是出在這裡 這裡報了個非法路徑異常, 出現了非法字元* 應該就是在讀某個路徑的時候,取得的值是“*:\app\nodejs\node.exe” 開頭是* ,不是程式希望的。 那問題來了 這個配置路徑的能是哪裡呢? 我想了半天唯一想到的可能是系統環境變量,去檢查下這裡确實有個*:

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

 當時為什麼配置了個*開頭的呢?實在想不起來了,用了兩三年也沒出過問題

先改成正常的試試

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

 再次運作仍然報錯,重新開機idea再試試,扔不好用,電腦重新開機試試

重置之後好了

Idea+Sonarlint無法使用問題 場景: 問題描述: 原因分析: 解決方案:

解決方案:

按提示找到配置有問題的環境變量,修改正常 儲存。

重新開機電腦