redhat-developer / vscode-xml

Editing XML in Visual Studio Code made easy
Eclipse Public License 2.0
262 stars 82 forks source link

Could not find or load main class org.eclipse.lemminx.XMLServerLauncher #1038

Open JavorszkyGaborOrianaWorld opened 1 week ago

JavorszkyGaborOrianaWorld commented 1 week ago

Type: Bug

Occurs on start, extension does not load...

Error: Could not find or load main class org.eclipse.lemminx.XMLServerLauncher Caused by: java.lang.ClassNotFoundException: org.eclipse.lemminx.XMLServerLauncher [Info - 2:22:22 PM] Connection to server got closed. Server will restart. [Error - 2:22:22 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:22 PM] XML Support client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 Error: Could not find or load main class org.eclipse.lemminx.XMLServerLauncher Caused by: java.lang.ClassNotFoundException: org.eclipse.lemminx.XMLServerLauncher [Info - 2:22:22 PM] Connection to server got closed. Server will restart. [Error - 2:22:22 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:22 PM] XML Support client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 Error: Could not find or load main class org.eclipse.lemminx.XMLServerLauncher Caused by: java.lang.ClassNotFoundException: org.eclipse.lemminx.XMLServerLauncher [Info - 2:22:24 PM] Connection to server got closed. Server will restart. [Error - 2:22:24 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:24 PM] XML Support client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:24 PM] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 Error: Could not find or load main class org.eclipse.lemminx.XMLServerLauncher Caused by: java.lang.ClassNotFoundException: org.eclipse.lemminx.XMLServerLauncher [Info - 2:22:24 PM] Connection to server got closed. Server will restart. [Error - 2:22:24 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:24 PM] XML Support client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:24 PM] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 Error: Could not find or load main class org.eclipse.lemminx.XMLServerLauncher Caused by: java.lang.ClassNotFoundException: org.eclipse.lemminx.XMLServerLauncher [Error - 2:22:25 PM] Connection to server got closed. Server will not be restarted. [Error - 2:22:25 PM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:25 PM] XML Support client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:22:25 PM] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097

Extension version: 0.27.2024111708 VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i7-1265U (12 x 2688)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|15.69GB (1.57GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
JavorszkyGaborOrianaWorld commented 1 week ago

Maybe the issue caused by the accented characters in the path?

My home is: c:\User\JávorszkyGábor (created by default the Microsoft EntraID joined Windows), so I cannot change it. I've found a native.encoding setting on the internet, but I don't know where to set it. (Sorry, my Java knowledge is low.)

angelozerr commented 6 days ago

Maybe the issue caused by the accented characters in the path?

My home is: c:\User\JávorszkyGábor (created by default the Microsoft EntraID joined Windows), so I cannot change it. I've found a native.encoding setting on the internet, but I don't know where to set it. (Sorry, my Java knowledge is low.)

Your are the first person who has this problem.

As you said I suspect the problem comes from encoding path, but we use native path glob support to do that.

@datho7561 have you some idea about this problem?

datho7561 commented 6 days ago

I was able to reproduce the issue by creating a new Windows user with accents in the path. I can look into it if you would like

angelozerr commented 6 days ago

It would be very great!

datho7561 commented 5 days ago

@JavorszkyGaborOrianaWorld one potential workaround is to use the binary. If you set "xml.server.preferBinary": true in VS Code's settings.json, this will use the binary.

Actually resolving the problem is a bit more complicated. I took some time to study this problem, and it seems like it's a java bug, so I don't know how much we can do.

My language on Windows is set to English. If I try to launch a java program with Cyrillic in the path it won't work. e.g. java -cp 'C:\Users\Девід\Documents\vscode-xml\server\org.eclipse.lemminx-0.28.0-uber.jar' org.eclipse.lemminx.XMLServerLauncher doesn't work java -jar 'C:\Users\Девід\Documents\vscode-xml\server\org.eclipse.lemminx-0.28.0-uber.jar' also doesn't work.

However, if I cd into the directory containing the jar and pass it as a relative path, this works. eg. cd C:\Users\Девід\Documents\vscode-xml\server; java -cp 'org.eclipse.lemminx-0.28.0-uber.jar' org.eclipse.lemminx.XMLServerLauncher should work. This is one potential workaround; we can set the cwd for the command to be run in the server launch options, which is similar to cd'ing into the directory before running the command.

The limitation to this workarond is if the user wants to extend the functionality of lemminx using the service provider interface by adding additional jars to the path (eg. lemminx-maven). The user is expected to specify those paths as absolute paths, so if any part of the path contains non-ASCII characters, java won't be able to find those jars.

JavorszkyGaborOrianaWorld commented 3 days ago

@datho7561 Thank for your help, the workaround is worked for me.