Closed veredcon closed 9 months ago
@snjeza might be the server doesn't cope well when initialization options are missing/incomplete. Please investigate.
@snjeza "Default VM Install changed from 1612768316552-/usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 to 1612768316579-/home/user/java11'," might be the cause, the new location might not be reachable
@veredcon could you try to add
"java.server.launchMode": "Standard",
to your settings.json
Hello @snjeza ,
Thanks for taking a look into this issue. I've already tried that and it still doesn't work. Attached are the logs with this settings configured.
client0.74.0-standard-not-working.txt server0.74.0-standard-not-working.txt
As this upgrade is a top priority task for us, could it be helpful if we even set a meeting and I'll show you our setup and all? I believe it make things harder that you cannot really reproduce this issue in your environment.
When I looked at the logs and code I could notice that when we enter configureDefaultVM and it returns changed=true things goes wrong. when it returns changed=false everything is OK and no errors appears.
So, when looking at the logic there, the jvmHome ="/home/user/java11" and the defaultVM=/usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 are not equal so it doesn't return false but continues. I'm not sure how to control the result of the defaultVM and how it gets this value but this path does not exist and is not reachable from the container where the extension runs.
Here is a screenshot of how things built in our environment:
Please let me know if you need more information / even prefer setting a short meeting. Thanks a lot in advance! Vered
Additional info - now I noticed that even when the isWorkspaceInitialized code is commented out, it works only in LightWight Mode and not in Standard mode... I attached these logs just in case... these are the logs of vsix which I commented out this code:
075withpatch-lw-standard.txt server075withpatch-lw-standard.txt
@veredcon you can try
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/home/user/java11",
"default": true
}
],
Thanks @snjeza , Yes I tries that too and got another error :(
So with these settings:
We get the following logs: client074withruntime.txt server074withruntime.txt
Thanks!
Here is a screenshot of how things built in our environment:
$ cd /user/home/java11
$ ls
bin
JAVA_HOME has been incorrectly configured. It should look like the following:
$ ls -la sapjava11
lrwxrwxrwx. 1 snjeza snjeza 34 Feb 8 19:15 sapjava11 -> /usr/local/sapmachine-jdk-11.0.10/
$ ls -la sapjava11/
total 40
drwxr-xr-x. 9 root root 4096 Feb 8 19:05 .
drwxr-xr-x. 50 root root 4096 Feb 8 19:05 ..
drwxr-xr-x. 2 root root 4096 Feb 8 19:05 bin
drwxr-xr-x. 4 root root 4096 Feb 8 19:05 conf
drwxr-xr-x. 3 root root 4096 Feb 8 19:05 include
drwxr-xr-x. 2 root root 4096 Feb 8 19:05 jmods
drwxr-xr-x. 73 root root 4096 Feb 8 19:05 legal
drwxr-xr-x. 6 root root 4096 Feb 8 19:05 lib
drwxr-xr-x. 4 root root 4096 Feb 8 19:05 man
-rw-r--r--. 1 snjeza snjeza 1229 Jan 19 23:08 release
Hi @snjeza
In our JAVA_HOME is pointing to /home/user/java11 and has only link to bin. Do you mean that it has to include other folders like conf, lib etc. because you rely on them in your logic?
As we saw in the logs, JavaRuntime.getDefaultVMInstall().getInstallLocation() returns /usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 and we don't want the change to /home/user/java11 to happen. We want the server to continue look on the path /usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 because in that case it seems to work fine.
Since the "patch" I did in the server did not work in all launchModes (only in LightWeight) I tried another way to prevent this changing in configuration in the server to happen - In the vscode extension itself, in the extension.ts file, I forced the java.home being passed to the server to be null. All other properties will still be passed as is.
In that case, the server is getting java.home=null and I guess uses some default so that's the reason it still works:
!MESSAGE >> New configuration: {java={home=null, jdt={ls={vmargs=-DwatchParentProcess=false -noverify -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=98632K -Xss1M -Xmx437943K -XX:+UseG1GC -XX:+UseStringDeduplication}}, errors={incompleteClasspath={severity=warning}}, configuration={checkProjectSettingsExclusions=false, updateBuildConfiguration=automatic, maven={userSettings=null, globalSettings=null}, runtimes=[]}, trace={server=off}, import={maven={enabled=true}, gradle={enabled=true, wrapper={enabled=true}, version=null, home=null, java={home=null}, offline={enabled=false}, arguments=null, jvmArguments=null, user={home=null}}, exclusions=[/node_modules/, /.metadata/, /archetype-resources/, /META-INF/maven/]}, maven={downloadSources=false, updateSnapshots=false}, eclipse={downloadSources=false}, referencesCodeLens={enabled=false}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}}, saveActions={organizeImports=false}, project={referencedLibraries=[lib/*/.jar], importOnFirstTimeStartup=interactive, importHint=true, resourceFilters=[node_modules, .git]}, contentProvider={preferred=null}, autobuild={enabled=false}, maxConcurrentBuilds=1.0, completion={maxResults=0.0, enabled=true, overwrite=true, guessMethodArguments=false, favoriteStaticMembers=[org.junit.Assert., org.junit.Assume., org.junit.jupiter.api.Assertions., org.junit.jupiter.api.Assumptions., org.junit.jupiter.api.DynamicContainer., org.junit.jupiter.api.DynamicTest., org.mockito.Mockito., org.mockito.ArgumentMatchers., org.mockito.Answers.], filteredTypes=[java.awt., com.sun., sun.], importOrder=[java, javax, com, org]}, foldingRange={enabled=true}, progressReports={enabled=true}, codeGeneration={hashCodeEquals={useJava7Objects=false, useInstanceof=false}, useBlocks=false, generateComments=false, toString={template=${object.className} [${member.name()}=${member.value}, ${otherMembers}], codeStyle=STRING_CONCATENATION, skipNullValues=false, listArrayContents=true, limitElements=0.0}}, selectionRange={enabled=true}, showBuildStatusOnStart={enabled=false}, server={launchMode=Standard}, sources={organizeImports={starThreshold=99.0, staticStarThreshold=99.0}}, semanticHighlighting={enabled=true}, refactor={renameFromFileExplorer=prompt}, imports={gradle={wrapper={checksums=[]}}}, templates={fileHeader=[], typeComment=[]}, references={includeAccessors=true}}}
Full Logs of that path: client074-with-frontend-patch.txt server074-with-frontend-patch.txt
Is there some configuration/workaround to force the LS not to change the configuration?
In our JAVA_HOME is pointing to /home/user/java11 and has only link to bin. Do you mean that it has to include other folders like conf, lib etc. because you rely on them in your logic?
Right. Eclipse JDT requires a valid JDK.
We want the server to continue look on the path /usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 because in that case it seems to work fine.
you can try
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1",
"default": true
}
],
/usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 have to have a valid JDK.
Is there some configuration/workaround to force the LS not to change the configuration?
You should start Java LS with a valid JDK. /usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1 is hidden, /user/home/java11 is incomplete.
@veredcon You can see how che creates a java sidecar - https://github.com/eclipse/che-plugin-registry/tree/master/sidecars/java
/projects $ echo $JAVA_HOME
/usr/lib/jvm/default-jvm/
/projects $ ls $JAVA_HOME
ASSEMBLY_EXCEPTION bin include legal release
LICENSE conf jmods lib
README demo jre man
/projects $
@snjeza Thank you so much for the suggestion! that worked!
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/usr/lib/sapmachine-jdk/sapmachine-jdk-11.0.6.0.1",
"default": true
}
],
together with the java.home settings!
Thanks a lot for your time and help! 🙏🎉👏
Hi @snjeza , Why this vsix is not available in this link? https://github.com/redhat-developer/vscode-java/releases/download/v0.75.0/redhat.java-0.75.0.vsix Since 0.61.0 seems you stopped the upload vsixs to the releases.
Can you load the vsix so it will be available?
Thanks!
@veredcon in the meantime, you can download it from one of those 2 marketplaces
Cool! We will download it from open-vsx, thanks a lot!
@veredcon Do you still have issues or you were abel to handle what you wanted?
Environment
Steps To Reproduce
I cannot provide steps to reproduce as this issue happens in our special setup Web IDE where we use multiple docker containers and the JDK is installed in a different container from where the vscode-java extension runs.
The version we used so far is 0.46.0 which worked fine, and now we are facing some obstacles when trying to upgrade. We managed to pass the activation phase of the VScode extension, using JDK 11, however encountered LSP issues in our environment.
For example: root INFO [hosted-plugin: 66824] { message: '[Info - 3:45:03 PM] Feb 7, 2021, 3:45:03 PM Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor is of type UndefinedConstructorInDefaultConstructor', level: 'info', timestamp: '2021-02-07 15:45:03.783' } And there is an issue to find basic types (like Integer/String) so seems like some configuration went wrong on the way:
After extensive investigation in the frontend and server code, we found that this piece of code causes these LSP errors: https://github.com/eclipse/eclipse.jdt.ls/commit/7a0872bdef3ef7751da9a90021c43e14ee85e446#diff-0ef00af71cdc38cf5969fb55251c0b924ceb64d6c88727308683209ffa773ea7R117-R125 https://github.com/eclipse/eclipse.jdt.ls/blob/8028f3ffc04e7f4695ffa08d058912e2003a0116/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseInitHandler.java#L117-L124 (master code)
More info on the settings.json we use:
Attached are the client and server logs in this case of:
0.46.0 - version we used and always worked. (only 1 log file was available in that version) server0.46.0-works-ok.txt
0.53.1 - still working version (client+server) client0.53.1-works-ok.txt server.0.53.1-works-ok.txt
0.74.0 - logs of not working version (client+server) server-0.74.0-not-working.log.txt client-0.74.0-not-working.log.txt
master code (0.75.0) which I built with the server modification I mentioned, commented out the configureJVMs, added this note also in a log with prefix "VERED". In this case it work OK for us. client-0.74.0-work-ok--isworkspaceinitialized-comment.log.txt
Current Result
Java LS does not recognized our JDK and as a result we get basic errors as the screenshot and logs.
Expected Result
To have some kind of workaround/ configurable settings to allow us bypass the errors. For example, if we are not entering the code of isWorkspaceInitialized=false (configureJVMs) we are OK. Can we control this value?
Additional Informations