Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK version updated, now Karate tests cannot be found [duplicate]

Today our IT department initialized an automatic uninstall of Java JDK 14 due to some security concern. I downloaded the latest, JDK 16, and updated all of my project settings using this as a guide: Error:java: invalid source release: 8 in Intellij. What does it mean?

I also updated the JAVA_HOME environment variable and the path variable. However, when attempting to run my Karate automation tests using IntelliJ like I normally do, I am getting an error that no tests were found. Here is the full system response when trying to run a test:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.intuit.karate.Runner$Builder.tagSelector(Runner.java:80)
    at com.intuit.karate.Runner.parallel(Runner.java:309)
    at com.intuit.karate.Runner$Builder.parallel(Runner.java:190)
    at com.intuit.karate.cli.Main.main(Main.java:59)
    at cucumber.api.cli.Main.main(Main.java:34)
Caused by: java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.createBindings()" because "com.intuit.karate.ScriptBindings.NASHORN" is null
    at com.intuit.karate.ScriptBindings.createBindings(ScriptBindings.java:160)
    at com.intuit.karate.core.Tags.<init>(Tags.java:158)
    at com.intuit.karate.core.Tags.<clinit>(Tags.java:48)
    ... 5 more

Process finished with exit code 1

Apparently this is a problem with JDK versions above 14. I tried to troubleshoot with this video: https://www.youtube.com/watch?v=8bHeDl3tdoo

But after making that change to the pom.xml file, now I'm getting a new error:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/allison_crenshaw/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/allison_crenshaw/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.14.0/log4j-slf4j-impl-2.14.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

I visited the page it recommends (http://www.slf4j.org/codes.html#multiple_bindings) but I don't really understand how to proceed after reading the explanation. I tried adding in the exclusion it recommends but my pom.xml file is really long so I wasn't really sure where the exclusion code belonged in the grand scheme of things. I tried putting it just under the code recommended by the YouTube video to resolve the binding issue but I got the same error about the class path containing multiple SLF4J bindings.

Thanks in advance for any help.

like image 839
Allison Crenshaw Avatar asked Dec 31 '25 07:12

Allison Crenshaw


1 Answers

Please upgrade to Karate 1.0 (1.1.0 is the latest as of now) because old versions don't support newer Java versions.

Note that you may need to make a few changes: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

like image 72
Peter Thomas Avatar answered Jan 05 '26 05:01

Peter Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!