Problems building with correct Java version

I am using the below pipeline script. JDK 17 has installed, our Jenkins is running on JDK 21 and SonarQube 10.7 version bu tstill getting an error. Kindly, Please assist. Thanks in advance,

Pipeline:
stage(‘Sonar’) {
agent { label ‘sl16vmcj’ }
tools {
jdk ‘JDK-17’
maven ‘maven-3.9.6’
}
when {
expression {
return params.RUN_SONAR || !(IS_RELEASE.toBoolean()) && env.BRANCH_NAME == ‘master’
}
}
options {
timeout(time: 30, unit: ‘MINUTES’)
}
steps {
bat ‘mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar -X’
}
}

Error:
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.ex.customer:myproject:war:2.10.359.SNAPSHOT: The following artifacts could not be resolved: jdk:tools:jar:5.0: Could not find artifact jdk:tools:jar:5.0 at specified path C:\Program Files\Microsoft\jdk-17.0.10+7/…/lib/tools.jar