How to resolve – java.lang.VerifyError java.lang.SecurityException: Signers of org.junit.runner.Runner do not match signers of other classes in package

Problem:

Have you ever encountered the following exception when you were trying to run a JUnit Class with isolation framework like JMockit?

java.lang.VerifyError: java.lang.SecurityException: Signers of 'org.junit.runner.Runner' do not match signers of other classes in package
	at java.lang.J9VMInternals.verify(J9VMInternals.java:74)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:129)
	at org.junit.runner.Request.aClass(Request.java:45)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:24)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Root Cause:

After quite a few attempts and reserch, I discovered that the error is due to the conflict with the default version of the JUnit provided by the eclipse.

Solution:

Follow the following steps to resolve the issue. Happy JUniting and JMockiting.

  1. Remove the build reference to existing JUnit jar file from your build path.
  2. Download and use the independent Junit Jar file in your library.