Vscode-java-test: Test Runner stop working with JDK 8

Created on 18 Aug 2020  路  11Comments  路  Source: microsoft/vscode-java-test

Hi,

Got this error after updating to Java Test Runner version 0.24.1 from version 0.24
I'm using VSCode Version 1.46.1 and the latest versions of "Language Support for Java by Red Hat" and "Debugger for Java".
After the update I couldn't see any of my junit tests in the "Test"-Tab and couldn't start them from within the IDE.
Downgrading back to 0.24 resolved the issue.

Let me know if you need additional informations.

question

Most helpful comment

@JMaterne @UnrealKazu

Yes, Since the newest Language Support for Java extension requires JDK11 now, so the newest Java Test Runner also update the requirement to JDK11. Downgrade the extension should be a workaround for now. But it's strongly not recommended to stay at the old version, since you'll miss a lot improvement.

Though I do not know the reason why cannot upgrade to JDK 11. But I think there is some misunderstanding here. The JDK 11 is only needed to launch the Java Language Server. You can still use JDK 8 to build your project. Please find this comment for more details: https://github.com/redhat-developer/vscode-java/issues/1543#issuecomment-663382692

All 11 comments

Have you observed any errors in the output channel Language Support for Java?

You need to set the setting java.trace.server to verbose

Got these upon loading the project:

[Trace - 12:11:07] Sending request 'workspace/executeCommand - (3)'.
Params: {
    "command": "vscode.java.test.get.testpath",
    "arguments": [
        [
            "(..mypath..)"
        ]
    ]
}

[Trace - 12:11:07] Sending request 'workspace/executeCommand - (4)'.
Params: {
    "command": "vscode.java.test.get.testpath",
    "arguments": [
        [
            "(..mypath..)"
        ]
    ]
}

[Trace - 12:11:07] Received response 'workspace/executeCommand - (3)' in 185ms. Request failed: No delegateCommandHandler for vscode.java.test.get.testpath (-32601). [Trace - 12:11:07] Received response 'workspace/executeCommand - (4)' in 197ms. Request failed: No delegateCommandHandler for vscode.java.test.get.testpath (-32601).

Refreshing the Test-Explorer gives the same failure description.

It seems that something wrong happens when the language server loading the jar bundle of Test Runner. Would you mind to do the following things for further doagnostic?

  1. Check if there is any error message in the server log, you can get the server log by trigger the command Java: Open Java language server log file
  2. Try to entirely remove the extension file and reinstall it, you can find it at $HOME/.vscode/extensions/vscjava.vscode-java-test-0.24.1
  3. Try to remove the language server's cache. The cache file locates at:

    • Win: C:\Users\<your_user_id>\AppData\Roaming\Code\User\globalStorage\redhat.java

    • Mac: /Users/<your_user_id>/Library/Application Support/Code/User/globalStorage/redhat.java

Thanks

Thanks for your instructions.
The server log contains these errors:

!ENTRY com.microsoft.java.test.plugin 4 0 2020-08-19 09:07:52.291
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.microsoft.java.test.plugin [213]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1687)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)


!ENTRY org.eclipse.jdt.ls.core 4 0 2020-08-19 09:07:52.294
!MESSAGE Failed to load extension bundles 
!STACK 1
org.eclipse.core.runtime.CoreException: Load bundle list
    at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:169)
    at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:77)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:228)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Contains: Bundle startup failed reference:file:/c:/Users/jm/.vscode/extensions/vscjava.vscode-java-test-0.24.1/server/com.microsoft.java.test.plugin-0.24.1.jar
org.osgi.framework.BundleException: Could not resolve module: com.microsoft.java.test.plugin [213]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:439)
    at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.startBundles(BundleUtils.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:167)
    at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:77)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:228)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
!SUBENTRY 1 org.eclipse.jdt.ls.core 4 0 2020-08-19 09:07:52.295
!MESSAGE Load bundle list
!SUBENTRY 2 org.eclipse.jdt.ls.core 4 0 2020-08-19 09:07:52.295
!MESSAGE Bundle startup failed reference:file:/c:/Users/jm/.vscode/extensions/vscjava.vscode-java-test-0.24.1/server/com.microsoft.java.test.plugin-0.24.1.jar
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.microsoft.java.test.plugin [213]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:439)
    at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.startBundles(BundleUtils.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:167)
    at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:77)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:228)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

Are you using JDK 11?

No I'm using JDK 8

I've got the same error, whilst also using JDK 8. I cannot upgrade to JDK 11 yet due to external dependencies, and therefore I had downgraded the Language Support for Java extension from 0.65.0 to 0.64.1 in order to keep on working.

I'm guessing that Java Test Runner 0.24.1 has similar dependencies on JDK 11 as across the board support for JDK 8 is being dropped? Downgrading back to 0.24.0 has solved the issue for me as well. So this will be the temporary workaround for me.

@JMaterne @UnrealKazu

Yes, Since the newest Language Support for Java extension requires JDK11 now, so the newest Java Test Runner also update the requirement to JDK11. Downgrade the extension should be a workaround for now. But it's strongly not recommended to stay at the old version, since you'll miss a lot improvement.

Though I do not know the reason why cannot upgrade to JDK 11. But I think there is some misunderstanding here. The JDK 11 is only needed to launch the Java Language Server. You can still use JDK 8 to build your project. Please find this comment for more details: https://github.com/redhat-developer/vscode-java/issues/1543#issuecomment-663382692

Rolling back to 0.24.0 fixed the issue for me as well.

@ccarv If only use JDK 11 to launch the Java Language Server, will it work for your case?

I've got the same error, whilst also using JDK 8. I cannot upgrade to JDK 11 yet due to external dependencies, and therefore I had downgraded the Language Support for Java extension from 0.65.0 to 0.64.1 in order to keep on working.

I'm guessing that Java Test Runner 0.24.1 has similar dependencies on JDK 11 as across the board support for JDK 8 is being dropped? Downgrading back to 0.24.0 has solved the issue for me as well. So this will be the temporary workaround for me.

Thank you so much ,downgrade Language Support for Java and Java Test Runner, it works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fbricon picture fbricon  路  5Comments

jbelford picture jbelford  路  5Comments

andifalk picture andifalk  路  9Comments

mccreery picture mccreery  路  4Comments

lashchev picture lashchev  路  5Comments