redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 442 forks source link

Can't resolve imports on an Eclipse project #284

Open gbbarroso opened 7 years ago

gbbarroso commented 7 years ago

Just tried the extension on an existing eclipse project, no imports could be resolved, not even the java.lang ones:

image

On output console:

[Warn - 3:12:21 PM] Aug 23, 2017 3:12:15 PM While loading class "org.eclipse.m2e.core.MavenPlugin", thread "Thread[Worker-2,5,main]" timed out waiting (5154ms) for thread "Thread[pool-1-thread-1,5,main]" to finish starting bundle "org.eclipse.m2e.core_1.8.1.20170728-1531 [52]". To avoid deadlock, thread "Thread[Worker-2,5,main]" is proceeding but "org.eclipse.m2e.core.MavenPlugin" may not be fully initialized. Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="1.8.1.20170728-1531"; osgi.identity="org.eclipse.m2e.core"; singleton:="true" [id=52] STARTED [STARTED] org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="1.8.1.20170728-1531"; osgi.identity="org.eclipse.m2e.core"; singleton:="true" [id=52] STARTED [STARTED] at org.eclipse.osgi.container.Module.lockStateChange(Module.java:337) at org.eclipse.osgi.container.Module.start(Module.java:401) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468) at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529) at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368) at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36) at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:442) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.eclipse.jdt.ls.core.internal.managers.MavenProjectImporter.(MavenProjectImporter.java:53) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importers(ProjectsManager.java:176) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.getImporter(ProjectsManager.java:160) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:73) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.run(InitHandler.java:117) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 5 seconds to acquire the lock. at org.eclipse.osgi.container.Module.lockStateChange(Module.java:334) ... 18 more

On the VSCode developer tools:

/C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29 Invalid arguments: Error: Invalid arguments at new e (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:23:230953) at asRange (C:\Users\gabriel.barroso.vscode\extensions\redhat.java-0.8.0\node_modules\vscode-languageclient\lib\protocolConverter.js:41:16) at asLocation (C:\Users\gabriel.barroso.vscode\extensions\redhat.java-0.8.0\node_modules\vscode-languageclient\lib\protocolConverter.js:205:59) at item.map (C:\Users\gabriel.barroso.vscode\extensions\redhat.java-0.8.0\node_modules\vscode-languageclient\lib\protocolConverter.js:195:43) at Array.map (native) at asDefinitionResult (C:\Users\gabriel.barroso.vscode\extensions\redhat.java-0.8.0\node_modules\vscode-languageclient\lib\protocolConverter.js:195:25)

Environment
fbricon commented 7 years ago

It looks like the problem is caused by the Maven plugin failing to start, caused by a corrupt workspace. Can you try cleaning the workspace directory?

Xarkam commented 7 years ago

Have same problem and after reseting workspace image Repository if you want test: https://github.com/Elfen59/bot-discord

Java --version: image

VSCode version: 1.17.2 Extension version: 0.12.0 server log:

!SESSION 2017-10-21 12:16:31.821 -----------------------------------------------
eclipse.buildId=unknown
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
Command-line arguments:  -data C:\Users\xarkam\AppData\Roaming\Code\User\workspaceStorage\12ab9696c50921bc5ee96717b0461f45\redhat.java\jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:32.638
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:32.715
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:32.717
!MESSAGE Initializing Java Language Server 0.6.0.201710180038

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:32.753
!MESSAGE Creating the default Java project

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:33.067
!MESSAGE Finished creating the default Java project

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:33.537
!MESSAGE >> workspace/didChangeConfiguration

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:33.816
!MESSAGE >>New configuration: {java={home=C:\Program Files\Java\jdk-9, jdt={ls={vmargs=-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication}}, errors={incompleteClasspath={severity=warning}}, configuration={updateBuildConfiguration=interactive, maven={userSettings=null}}, trace={server=off}, referencesCodeLens={enabled=false}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true}, import={exclusions=['**/node_modules', '**/.metadata']}, contentProvider={preferred=null}, debug={logLevel=warn}}}

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:33.819
!MESSAGE >> document/didOpen

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:33.923
!MESSAGE Importing Maven project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:36.784
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:36.793
!MESSAGE Caching AST for /BotDiscord/src/main/java/fr/freakyfamily/sombra/BotDiscord.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:36.942
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.265
!MESSAGE Releasing all ASTs

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.267
!MESSAGE Caching AST for /BotDiscord/src/main/java/fr/freakyfamily/sombra/BotDiscord.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.282
!MESSAGE begin problem for /BotDiscord.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.283
!MESSAGE 8 problems reported for /BotDiscord.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.285
!MESSAGE Reconciled 0, validated: 1. Took 52 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:37.415
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:38.153
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:40.147
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:16:40.365
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:02.374
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:02.611
!MESSAGE >> document/documentSymbol

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:02.618
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:02.644
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:05.442
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:08.458
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:09.074
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:49.142
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:49.769
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:17:51.318
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:45.154
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:45.396
!MESSAGE >> document/documentSymbol

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:45.398
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:47.565
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:47.809
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2017-10-21 12:21:47.811
!MESSAGE >> document/documentSymbol