Chapter 1: Error running the tests in Eclipse


I’ve recently started the M220 course and have so far managed to get all the setup running, except for the exact last step in the README file, i.e. the unit tests.
Whenever I try to run the tests, whether individually or as a whole, I get the following error:

java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineExecutionListener
at org.junit.platform.launcher.core.LauncherFactory.create(
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.EngineExecutionListener
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 12 more

I tend to believe this is related to the version 5 of JUnit that’s automatically imported through the provided pom.xml, which is probably incompatible with a lot of the imports that are used in the project.
Has anyone else encountered this issue? If so, have you managed to solve it?


Hi @Gabriel_94189,

Please share the command you have used to test. It is advised to use the below connection test first:

 mvn test -Dtest=ConnectionTest 

Also, if that is not the case, look at the following links for reference:

I am using the same pom.xml and I am able to run the tests.

Please let me know if it helps. If it does not, I will try my best to resolve this for you.


Hi Kanika,

Thanks for your prompt reply, it’s much appreciated. And thanks for your detailed answer.

The tests are running fine when using the Maven command in the terminal, as suggested by you.

The only issue I was having was when running the tests via Eclipse, and I have since found what the issue was. It looks like the pre-defined “Test runner” in the Run Configuration for the tests was set by Eclipse to be JUnit5, which from what I understand is not compatible with a lot of the elements of JUnit4.
What solved this issue for me was to open the Run Configuration in Eclipse and select JUnit4 as the Test Runner.

Hope this clarifies my problem & how I solved it and hopefully will help anyone else facing a similar issue in the future.



Thank you so much @Gabriel_94189. :slight_smile: I think it will help students for the same.