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

This question already has answers here:
karate.callSingle not found .feature file in karate-config.js
(2 answers)
Closed 1 year ago.
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.

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

This SLF4J message is not an error but just a warning:
SLF4J API is designed to bind with one and only one underlying logging framework at a time. If more than one binding is present on the class path, SLF4J will emit a warning, listing the location of those bindings.
[...]
NOTE The warning emitted by SLF4J is just that, a warning. Even when multiple bindings are present, SLF4J will pick one logging framework/implementation and bind with it.
[Emphasis by me.]
If the logging framework that has been selected is fine for you, you don't have to worry. If you want to get rid of the message you can check with mvn dependency:tree on your project which dependency pulls in which logging framework and set <exclusions> in your POM for those you don't want.

Related

Gradle did not find Minecraft Mappings for 1.12.2?

I would like to learn minecraft mod development, but there is an error with downloading the mappings
The error message is:
Could not resolve all files for configuration ':runtimeClasspathCopy'.
Could not find net.minecraftforge:forge:1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.
Searched in the following locations:
- file:~/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.pom
- file:~/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.jar
Required by:
project :
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
The directories specified does not exist. Also I tried downloading and importing the MCP instead of using an IntelliJ Plugin for Minecraft. The same error occurred while using this but there was a few more links (that leads to a webpage) that does not exists ("error 404 not found") if I clicked them.
The line in build.gradle which specifies the mappings used is at the moment:
mappings channel: 'snapshot', version: '20180814-1.12'
It was a stable version before and there was the same errors.
Does anyone know what I can do about it?
i had the same problem and i fix it by changing it to java 1.8 eclipse temurin
btw sorry for my bad english

Maven Javadoc generator String Index out of range

When I want to generate Javadocs with the maven-javadoc-plugin, the process fails with the error message:
[ERROR] javadoc: error - String index out of range: -6
[ERROR]
[ERROR] Command line was: /usr/lib/jvm/java-8-openjdk-amd64/jre/../bin/javadoc #options #packages
I tried enabling Debug Mode of Maven, Debug mode of the Javadoc Plugin, Debug mode of the javadoc generator itself. I have not gotten any more information than the message above. Not even a hint what class it fails to generate JavaDoc for.
Searching for this problem doesn't lead to much results either as all queries end in results for documentation about StringIndexOutOfBoundsException or other exception related problems.
I use version 3.2.0 of the maven-javadoc-plugin. But it doesn't seem to matter what version I use as the problem is also existent in version 2.7.
What I've found out so far is, that this error only occurs if I utilize stuff from a special dependency (currently the problem gets resolved if I remove all references to that dependency in code).
Said dependency is not public and was installed using the mvn install:install-file command. The classes in the dependency have been compiled with Java 6.
This is my last hope to get some information and maybe a solution to the problem.
Edit 1: It is definitely that dependency. If I manually remove it from the 'classpath' of the javadoc command (options file) then the error disappears.
Could it have something to do with me having a package name that matches exactly the package name used in the dependency?

Android compilation error after upgrading to 'com.google.android.gms:play-services-ads:18.1.0'

I am upgrading my play-services-ads library from version 12 to version 18.1:
dependencies {
api 'com.google.android.gms:play-services-ads:18.1.0'
}
The problem is that the compilation fails with this error:
.gradle/caches/transforms-1/files-1.1/play-services-ads-identifier-17.0.0.aar/75b3c9fbdc51199269673bd2fa8b6cfe/jars/classes.jar(com/google/android/gms/ads/identifier/AdvertisingIdClient.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy': class file for javax.annotation.concurrent.GuardedBy not found
I took away all the usages for AdvertisingIdClient and left only the import, but the problem persists:
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
Is there anything I am doing wrong?
com.google.android.gms:play-services-ads:18.1.0 depends upon com.google.android.gms:play-services-ads-identifier:17.0.0, among other libraries.
Your error indicates that com.google.android.gms:play-services-ads-identifier:17.0.0 references javax.annotation.concurrent.GuardedBy. However, that class is not in the Android SDK. The POM file for com.google.android.gms:play-services-ads-identifier:17.0.0 should be referencing a library that has an implementation of that class, but it does not seem to.
One library that has an implementation of that class is com.google.code.findbugs:jsr305. Adding a dependency on com.google.code.findbugs:jsr305 for a recent version (e.g., 3.0.2) gave you that class, satisfying the compiler.
So, there appears to be a bug in the Play Services SDK packaging, which my workaround resolves. You might want to add a comment in your module's build.gradle file to consider removing the com.google.code.findbugs:jsr305 if a future update to com.google.android.gms:play-services-ads fixes this bug.

Unable to derive module descriptor: Provider {class X} not in module

I am getting this error message when I try to compile my new modularized Java 11 application:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\inter\.m2\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module
This appears to be an issue from a dependency of a dependency. I can't even find which module is pulling it in so I can update it.
I am using openjdk 11.0.2, IntelliJ 2018.3.4, Maven
Any advice how I can troubleshoot or fix this? I have found very little documentation on this issue.
Xalan
I had a look at their bug tracker following their index page and wasn't able to find this reported and not sure how actively is the library being maintained either.
General Explanation
Just to explain what has caused the issue in your code, I would share a screenshot and then try to add details around it.
So within the JAR that for version 2.7.2, there are service declarations (META-INF/services) which include org.apache.xalan.extensions.bsf.BSFManager as one of them. The service file here has to indicate the Provider thereby for itself and the class is supposed to be present on the modulepath to be resolved for reliable configuration of modules.
In this case for the module xalan(automatic module), the service listed doesn't have the provider class packaged within the dependency itself. (See the package org.apache, it doesn't further have package bsf and the class BSFManager thereby. Hence the exception as you get.
Short term hack
One of the tweaks to get that resolved would be to get update the library jar (patch it) and get rid of the service file if you're not using it. Or to add the provider copied from the corresponding artifact.
If you don't directly depend on this artifact or its parent dependencies, you can let those remain on the --classpath and get resolved as an unnamed module for your application.
Long term solve
An ideal way would be to report this to the maintainers and getting it resolved. It depends though on how actively are they maintaining it e.g. the last release for xalan was almost 5 years back, might just want to look for an actively participated alternative in my opinion.
I tried to install update for TestNG in eclipse:
"Help -> Check for updates -> deselect all and select TestNG check box. Then
install latest version i installed the version which starts with 7.2.0.
It fixed the issue for me.

Sonar error message about Repeatable class not found when using Spring's #Scheduled with JDK7

We are using Spring's #Scheduled annotation and we use JDK 7. The code is working great, but when we analyse it using Sonar, we get the messages:
[DEBUG] Completing symbol : Scheduled
[ERROR] Class not found: java.lang.annotation.Repeatable
Is there any way to get rid of this error message?
I tried using #Schedules annotation to wrap the #Scheduled annotation, as suggested here, but that didn't help. Sonar keeps issuing this message.
This message is triggered when a .class file is not found in the binary dependencies you provide to the analyzer. This message is rather harmless in most cases but might be an indication in some cases that you are lacking some dependencies that can lead to less precise results for some rules (resulting in false negatives).
This ticket changed the level of this log from error to warn in the 3.11 version of the java plugin : https://jira.sonarsource.com/browse/SONARJAVA-1519

Categories

Resources