coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.59k stars 5.54k forks source link

[Bug]: #6630

Closed firasm closed 6 months ago

firasm commented 7 months ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. Run code-server
  2. Install the "Test Runner for Java" extension (+ other associated extensions)
  3. Use this project as a barebones demo
  4. Click on the Beaker on the left sidebar to try and run the Java Tests
  5. The Java tests will fail the first time with an error
  6. Running it again (doing nothing else) will run fine

Expected

No error the first time!

Actual

Error the first time, runs fine the next time

Logs

Here's the error:

Class not found model.ProjectInNeedTest
java.lang.ClassNotFoundException: model.ProjectInNeedTest
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
BuiltinClassLoader.java:581
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
ClassLoaders.java:178
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
ClassLoader.java:527
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:766)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:490)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

Are you accessing code-server over a secure context?

Notes

Hello,

My colleagues and I are trying to use the "Test Runner for Java" extension in a workspace using VS Code in the browser (specifically the code-server project).

We are trying to troubleshoot a really strange issue that only shows up in the cloud, and not when trying to run things locally.

Here is a very very simple Java project that when it's run in the browser, gives a Class not found model.SampleTest error.

Screenshot 2024-01-18 at 8 56 46 PM

However, when you do nothing else except just run the test one more time, it works just fine:

Screenshot 2024-01-18 at 8 57 03 PM

This happens for every project that's run in the cloud this way, so we are nearly 100% sure that it's got something to do with being execute remotely. The stack trace seems useful, but it's not something that gives me any insight so I thought I'd post here to ask for help in troubleshooting!

I also posted this in the vscode-java-test repo in case this was an issue with the extension.

Thanks for any advice you have to try and troubleshoot this.

firasm commented 7 months ago

P.S. I was not able to reproduce this bug in GitHub Codespaces. There the tests ran fine the first time.

code-asher commented 7 months ago

Thank you for confirming the behavior in Codespaces and the detailed reproduction! The only immediate thing that comes to mind is that maybe the extension versions are different? Edit: or Java version?

code-asher commented 7 months ago

Hmm, maybe not related to the extension version; the extension seems to work for me (v0.40.1) following the reproduction steps. I only installed vscjava.vscode-java-test, no other Java-related extensions. My Java version in case that indicates something:

$ java --version
openjdk 11.0.21 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
code-asher commented 6 months ago

Closing for inactivity, but let me know if the issue persists and we can continue trying to debug.