Same situation for me when running agent in docker container and using tools to select desired jdk.
Although JAVA_HOME and PATH are set correct for Java 11 a "java -version" tells me it is version 17.
I found out, that LD_LIBRARY_PATH still points to the folders of Java 17, which is the default java in the container.
So when you are able to remove the LD_LIBRARY_PATH it should work again.
BTW: I'm still searching for a solution how to avoid getting LD_LIBRARY_PATH set to the default jdk, but I don't know who is setting it.