Open pF-luis opened 1 year ago
So, this is strange.
First, I can't replicate it. Second, you can see here: https://github.com/redhat-developer/rsp-server/blob/db1a3299580983f61ce20016c0e6a0efef1c37d8/runtimes/bundles/org.jboss.tools.rsp.server.wildfly/src/main/java/org/jboss/tools/rsp/server/wildfly/servertype/JBossVMRegistryDiscovery.java#L24
the first thing we do is try to get this attribute from the definition. If it has a value, we return it (whether valid or not). If it doesn't, we return null.
if the path is null, we just return the default (ie the java 17). Otherwise, we try to add this path to the list of VMs and discover its version and other stuff.
Eventually we trace into where we actually add it to the model:
If the passed-in path is null (which it shouldn't be at this point) we'll use the default java installation (ie the java 17). Otherwise, we'll check its valid (is a folder, has a java binary file under it, etc etc) and then get its version by running java -version on it (which is many layers deeper than this code). The end result of this call is, if we know the jvm is added to the model, we return true, and if it couldn't be added to the model we return false. In the event we return false to ensuring this vm is added to the model, we return a null vm to the caller.
Long story short, if the path is invalid, we end up returning a null vm, not the java 17 vm. In this case, the error message would look like Server {0} can not find a valid virtual machine to use.
The only way we return the default vm is if the path is null, ie, the vm.install.path
attribute is empty or not set.
Have you tried repeating this? Creating the server over again?
Here you can see my server config, the vm.install.path within the configuration and down below in the Terminal what's at that location
The error message displays the error behavior I mentioned, that it wants to use the default jdk(version 17) instead of the jdk I provided via vm.install.path
In case I provide a wrong path like seen in the next screenshot, I can reproduce your described error pattern
Server Connector v0.26.12 Runtime Server Protocol UI v0.24.8 VS Code 1.79.2 (Linux)
Running within amazon corretto java 17 dev container. Everything seems to be working fine. I need Java 17 to use the java language support extension but then my current jboss cannot run on java 17 so I installed java 8 in parallel.
Now I wanted to point the RSP to use the java 8 installation on my jboss server, so I've set the
vm.install.path
as suggested on other issues and on the error hint within vscode itself.My rsp configuration looks like this:
The error message states the following
Not sure where I am wrong, seems to be I've set everything up properly.
Any hints would be appreciated, Thanks!