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 mvn exec:java ClassNotFoundException #548

Merged
merged 5 commits into from
Oct 10, 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: 4 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
- name: Compile with Maven
run: mvn -B compile test-compile --file pom.xml

- name: Test exec plugin
run: |
mvn exec:java -P sqlite -Dexec.args="-b noop -c config/sqlite/sample_noop_config.xml --create=true --load=true --execute=true"

- name: Test with Maven
run: mvn -B test --file pom.xml

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/oltpbenchmark/api/BenchmarkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public BenchmarkModule(WorkloadConfiguration workConf) {
this.workConf = workConf;
this.dialects = new StatementDialects(workConf);
// setClassLoader();
this.classLoader = ClassLoader.getSystemClassLoader();
this.classLoader = Thread.currentThread().getContextClassLoader();
}

/**
* Instantiates the classLoader variable, needs to be overwritten if benchmark uses a custom
* implementation.
*/
protected void setClassLoader() {
this.classLoader = ClassLoader.getSystemClassLoader();
this.classLoader = Thread.currentThread().getContextClassLoader();
}

// --------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/oltpbenchmark/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static <T> Constructor<T> getConstructor(Class<T> target_class, Class<?>.
* @return
*/
public static Class<?> getClass(String class_name) {
return getClass(ClassLoader.getSystemClassLoader(), class_name);
return getClass(Thread.currentThread().getContextClassLoader(), class_name);
}

/**
Expand Down