GZoltar / gzoltar

GZoltar - Java Library for Automatic Debugging http://www.gzoltar.com
Other
77 stars 34 forks source link

Fail to run Gzoltar on Math-97 (Exception in thread "main" java.lang.NoSuchMethodError) #47

Closed fabiosalamone closed 2 years ago

fabiosalamone commented 2 years ago

Context

I can't run Gzoltar vscode extension because I get the error: Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.getMethodName()Ljava/lang/String; I got the same error on Math-98, Math-95, Math-90 downloaded from Defects4j. The vscode extension works correctly with Math-100 and Math-101.

GZoltar arguments

I get the same error if I try to run the command from CLI. The command is: cd /home/except/Desktop/download_bugs/Math/97_IAE/.gzoltar/ && java -cp "build/":/home/except/.m2/repository/junit/junit/4.4/junit-4.4.jar:"hamcrest-core.jar":"gzoltarcli.jar" com.gzoltar.cli.Main listTestMethods /home/except/Desktop/download_bugs/Math/97_IAE/target/test-classes

Output

Environment

Additional Info

I found this https://github.com/GZoltar/gzoltar/issues/46 similar issue, but didn't helped me.

image

jose commented 2 years ago

Hi @fabiosalamone,

Thanks for reporting this.

Could you please: (1) list all files under the .gzoltar directory, i.e., execute ls /home/except/Desktop/download_bugs/Math/97_IAE/.gzoltar/? (2) Set up your project to use a more recent version of JUnit, e.g., 4.11, and re-run the GZoltar VSCode extension?

-- Best, Jose

fabiosalamone commented 2 years ago

Hi @jose

thanks for your reply.

  1. The output of the command is: drwxrwxr-x 5 except except 4096 mar 2 09:33 build
    -rw-r--r-- 1 except except 2206944 mar 2 09:33 gzoltaragent.jar
    -rw-r--r-- 1 except except 2146529 mar 2 09:33 gzoltarcli.jar
    -rw-r--r-- 1 except except 1499 mar 2 09:33 hamcrest-core.jar
    -rw-r--r-- 1 except except 381765 mar 2 09:33 junit.jar
    drwxrwxr-x 2 except except 4096 mar 2 09:33 sfl
    -rw-rw-r-- 1 except except 0 mar 2 09:33 tests.txt

If you need the recursive command, here is the output https://pastebin.com/UZTfcjw1

  1. Anyway, changing JUnit from 4.4 to 4.11 in pom.xml of every project has worked! I tried with Math-97, Math-98, Math-95 and Math-90 and now the extension works generating the fault localization report.

Thanks, Fabio

jose commented 2 years ago

Awesome, glad it worked. This is indeed similar to issue #46, i.e., an old/unsupported version of JUnit is on the classpath and GZoltar tries to use that one.

I've tried to address that by shading the Junit version required by GZoltar and including it in the gzoltar.jar file, but no success so far.