Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix script validation error on docker env #1004

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ngrinder-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ description = "ngrinder-core"
dependencies {
api (project(":ngrinder-groovy"))
api (group: "org.apache.commons", name: "commons-compress", version: "1.4.1")
api (group: "com.github.oshi", name: "oshi-core", version: "6.1.6")
api (group: "com.github.oshi", name: "oshi-core-java11", version: "6.4.13")

implementation files("${rootDir}/lib/grinder-3.9.1-patch.jar")
implementation (group: "org.pf4j", name: "pf4j", version: "3.0.1")
implementation (group: "javax.servlet", name: "javax.servlet-api", version: "3.1.0")
implementation (group: "commons-collections", name: "commons-collections", version: "3.2.1")
implementation (group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: jackson_version)
implementation (group: "com.fasterxml.jackson.core", name: "jackson-databind", version: jackson_version)
implementation (group: "net.java.dev.jna", name: "jna", version: "5.6.0")
implementation (group: "net.java.dev.jna", name: "jna", version: "5.14.0")
implementation (group: "commons-codec", name: "commons-codec", version: "1.14")
implementation (group: "com.beust", name: "jcommander", version: "1.32")
implementation (group: "ch.qos.logback", name: "logback-classic", version: "1.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import static org.ngrinder.common.util.Preconditions.checkNotEmpty;
import static org.ngrinder.common.util.Preconditions.checkNotNull;
import static org.ngrinder.common.util.SystemInfoUtils.getAvailableMemory;
import static org.ngrinder.common.util.SystemInfoUtils.getJDKVersion;

/**
* Class which is responsible to build custom jvm arguments.
Expand Down Expand Up @@ -205,7 +204,7 @@ public String buildJVMArgumentWithoutMemory() {
addAdditionalJavaOpt(jvmArguments);
}

String jdkVersion = getJDKVersion();
String jdkVersion = System.getProperty("java.specification.version");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getJDKVersion() method called only here. And it is not related with Oshi �unlike the other methods. So, remove the method and change to check system property here directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change also make Script Validation function doesn't depends on SystemInfoUtils. So, I expect that NoClassDefFoundError does not occur anymore.

if (jdkVersion != null && !jdkVersion.startsWith("1.")) {
jvmArguments.append(" --add-opens java.base/java.net=ALL-UNNAMED ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import static com.sun.jna.Platform.isWindows;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.getProperty;
import static oshi.util.ExecutingCommand.runNative;

/**
Expand Down Expand Up @@ -104,10 +103,6 @@ public static BandWidth getNetworkUsage() {
return getBandWidth(rx, tx);
}

public static String getJDKVersion() {
return getProperty("java.specification.version");
}

private static BandWidth getBandWidth(long rx, long tx) {
BandWidth bandWidth = new BandWidth(currentTimeMillis());
bandWidth.setReceived(bandWidth.getReceived() + rx);
Expand Down
Loading