Maven jdk version mismatch error

Hi, Could you please help me with this one?

We recently did a Jenkins version update and we rolled back to previous version for some reasons but since then we couldn’t run any of our test in jenkins as it throwing jdk 17 version not compatible(but we have been running our test on jenkins with same version of java for more than a year). So, I manually installed few of the plugins. Even still it didn’t resolve the actual issue. So, I tried downgrading my java version to see if that helps but ended up with same error again.

I have gone through all the posts but nothing worked in my favour. Kindly help.

Also, I had updated the java path in toolchains.xml but nothing seemed worked. Also, checked all the environment variables they all look fine.

Jenkins version: 2.401.3
Current java version: 11(previously it was 17)
Apache maven : 3.8.5
Maven plugin version: 3.23

Exception in thread “main” java.lang.ClassNotFoundException: hudson.remoting.Launcher
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
ERROR: ================================================================================
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
ERROR: Invalid project setup: Connection reset
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
ERROR: [JENKINS-18403][JENKINS-28294] JDK ‘Java 11’ not supported to run Maven projects.
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:136)
ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the controller.
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:66)
ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
ERROR: Retrying with agent Java and setting compile/test properties to point to C:\Program Files\AdoptOpenJDK\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2.

Seems you’re using the maven project type. This is known to have problems with different jdk versions. See Maven Integration
Possibly you should try to run controller and agent with java 17

Thanks for the response.I’m afraid we have too many jobs at the moment an they were working fine with jdk 17 since last year and suddenly we started noticing this. Are there any other workaround to fix it?

And this error also occurring even when we run jobs to update repository.

Also, on the agent node we use different version remoting agent and we were able to run the test as usual but the main one throws an error.