Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows: LanguageServer not initialized after 10s #25

Closed
brunpoern opened this issue Dec 11, 2017 · 14 comments
Closed

On Windows: LanguageServer not initialized after 10s #25

brunpoern opened this issue Dec 11, 2017 · 14 comments
Milestone

Comments

@brunpoern
Copy link

Hi,

I just wanted to try out the new STS4 beta version with a simple Spring Boot Demo project. But when starting Eclipse STS4 I always get the following error in the Eclipse Error Log:

LanguageServer not initialized after 10s

with the following stack trace:

java.util.concurrent.TimeoutException
	at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at org.eclipse.lsp4e.LanguageServerWrapper.getServerCapabilities(LanguageServerWrapper.java:488)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrappers(LanguageServiceAccessor.java:243)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSPDocumentInfosFor(LanguageServiceAccessor.java:354)
	at org.eclipse.lsp4e.ConnectDocumentToLanguageServerSetupParticipant$1.run(ConnectDocumentToLanguageServerSetupParticipant.java:74)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

And in the progress window the "Initialize Language Servers for DemoApplication.java" task hangs forever.

For installation I downloaded the "Spring Tools 4 for Eclipse" distribution and created an empty workspace without any additional customization:

Spring Tool Suite 4

Version: 4.0.0.M6
Build Id: 201711271125

My Eclipse is started with :

java.version=1.8.0_121
java.home=D:<JDK_HOME>\jre

If I understand it correctly Eclipse should start the Spring Boot Language Server but I guess this somehow fails. But I have no idea why or where I should look for further information. In the Eclipse workspace log I only see these log messages:

!ENTRY org.eclipse.ui 2 0 2017-12-11 12:52:33.022
!MESSAGE Warnings while parsing the images from the 'org.eclipse.ui.commandImages' extension point.
!SUBENTRY 1 org.eclipse.ui 2 0 2017-12-11 12:52:33.022
!MESSAGE Cannot bind to an undefined command: plug-in='org.eclipse.lsp4e', id='org.eclipse.lsp4e.togglehighlight'

!ENTRY org.eclipse.jface 2 0 2017-12-11 12:52:34.116
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2017-12-11 12:52:34.116
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
	ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
		Open a type in a Java editor,
		Category(org.eclipse.ui.category.navigate,Navigate,null,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@a7ae340,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
	ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
		,
		Category(org.eclipse.lsp4e.category,Language Servers,null,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5e8bd498,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,,system)

!ENTRY org.eclipse.lsp4e 4 0 2017-12-11 12:52:48.050
!MESSAGE LanguageServer not initialized after 10s
!STACK 0
java.util.concurrent.TimeoutException
	at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at org.eclipse.lsp4e.LanguageServerWrapper.getServerCapabilities(LanguageServerWrapper.java:488)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrappers(LanguageServiceAccessor.java:243)
	at org.eclipse.lsp4e.LanguageServiceAccessor.getLSPDocumentInfosFor(LanguageServiceAccessor.java:354)
	at org.eclipse.lsp4e.ConnectDocumentToLanguageServerSetupParticipant$1.run(ConnectDocumentToLanguageServerSetupParticipant.java:74)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

Any help is highly appreciated. The new "Runtime information in your editor" features looks really cool and I can't wait to try it out on my machine :-)

Thanks and regards,
Andreas

@kdvolder
Copy link
Member

Your guess that the Eclipse (lsp4e component) is having troubles starting the language server seems about right. But unfortunately I also don't have much of an idea why. It could be related to the JVM setup. Maybe language server start can't find the JVM somehow. Also I think we need a JDK not a JRE.

You may be one of the first people to try it on a Windows box, (all of us are on Mac or Linux) so it could be it simply doesn't work on Windows. I'll try it later on a Windows VM setup and see if it works for me.

About the only suggestion I have for now, make sure your Java setup is a JDK not a JRE. But its a bit of a wild guess only.

@kdvolder
Copy link
Member

Good news... (or bad, depending on how you look at it :-). I tried STS4 on my windows VM and it doesn't work. Getting very similar problems to what @brunpoern describes. Of course its bad we are having problems running on Windows, but its good that I can reproduce the problem, so I can try to debug it now.

@kdvolder kdvolder changed the title LanguageServer not initialized after 10s On Windows: LanguageServer not initialized after 10s Dec 11, 2017
@kdvolder
Copy link
Member

I've pushed some fixes. I'll do some more testing tomorrow on windows. I did get the boot-java support to work properly on windows. But didn't have much time to test it yet.

@brunpoern
Copy link
Author

I just installed the latest nightly build and it seems to work. Awesome. Thank you very much for the fast response.

@brunpoern
Copy link
Author

I now tried to use the Language Server feature with a more complex example. The example project is part of a bigger Gradle multi-project build and in the Eclipse workspace there are also some unused pom.xml files (we migrated to Gradle recently). If I start Eclipse I get Spring Boot Java Language Server Error "Cannot load Gradle project model from folder: ...". Sometimes I also get the error "Cannot load Maven project model ..." where it picks a (random?) pom.xml file from my Eclipse workspace. I'm wondering what STS4/Language Server expects here. Does it really try to load my build files? The Eclipse projects itself doen't have any Maven/Gradle nature. We just generate Eclipse project files from Gradle and import them as normal Java Projects. Does STS4 require to have Gradle/Maven Eclipse projects or should it also work with "plain" Java projects?

In the Eclipse workspace log I get the following error but I'm not sure if it's related:

!ENTRY org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer 4 1000 2017-12-12 11:13:56.774
!MESSAGE Missing header Content-Length in input "
"
!STACK 0
java.lang.IllegalStateException: Missing header Content-Length in input "
"
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:73)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Should I create a new issue for this problem?

Thanks and regards,
Andreas

@BoykoAlex
Copy link
Contributor

No it doesn't require Eclipse projects... Which Gradle version is being used by your project?
There is a limitation in the STS4 tooling related to Gradle projects at the moment (due to a bug in Gradle which was fixed for the latest Gradle version leaving us with limitations for older versions). Any chance you can point us to a git repo with your Gradle project(s) to try?
I'd say it's a separate issue. Unlikely to be Win specific.

@brunpoern
Copy link
Author

I created a new issue for the Gradle/Maven problem.

@martinlippert
Copy link
Member

@brunpoern

I just installed the latest nightly build and it seems to work. Awesome. Thank you very much for the fast response.

Does that mean we can close this issue already as fixed or is anything still open here?

@kdvolder
Copy link
Member

Having both gradle and maven build files will confuse the tooling. I can't predict right now what will happen if you do that (nor do I know what would be a good way to handle it since I don't see how the tooling could guess which one you really wanted to use). I don't think it will pick randomly, the result will be deterministic, but I really wouldn't expect it to work.

@brunpoern
Copy link
Author

@martinlippert
From my point of view this issue can be closed. It works for me with a simple Maven demo project. And again, the runtime information view is really cool :-)

@kdvolder
Please forget the mixture of Gradle and Maven build files. I guess it was a bit confusing. And I deleted the pom.xml files in the meantime :-) So now we have only Gradle build files. But as explained in the new issue, we don't import them directly in Eclipse.

@anumalasri
Copy link

After updating Latest Nightly Build (Spring Tool Suite 4 Version: 4.0.0.CI-B803 Build Id: 201801051108),

the below error still coming in logs and STS4 got frozen during that time...

Some times, it will be back in few seconds and some times, it won't be back.

Just wonder, Any option available to skip LSP in STS4 ?

!ENTRY org.eclipse.lsp4e 4 0 2018-01-09 11:31:52.272
!MESSAGE 
!STACK 0
java.util.concurrent.TimeoutException
	at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at org.eclipse.lsp4e.operations.hover.LSBasedHover.getHoverInfo(LSBasedHover.java:134)
	at org.springframework.tooling.boot.java.ls.jdt.SpringBootJavaHoverProvider.getHoverInfo(SpringBootJavaHoverProvider.java:35)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:170)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:130)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:86)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)

@BoykoAlex
Copy link
Contributor

It's likely you have a rogue LS process running on your system Close STS4, shut down boot apps if there are any running. Run jps command in the console and see if you have any JarLauncher processes. If yes, these are the boot-java language servers process. Kill them then restart STS - ideally that should do it.
If you wish to turn off LSP support in STS4 completely you'd have to uninstall the Spring Boot Java feature from STS... (from About Spring Tool Suite -> Installation Details etc.)

@anumalasri
Copy link

Thanks for your quick response. Yes, there are two processes running each for JarLauncher and boot-properties-language-server-0.1.3-SNAPSHOT.jar.

I will try to kill those processes and see.

I believe, these processed triggered from STS4. Would not they be closed when STS4 get closed (gracefully) ?

@BoykoAlex
Copy link
Contributor

They should be shut down when STS is closed. Were you trying to run VSCode or Atom with boot-java or boot-properties extensions?
Were you always exiting gracefully from STS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants