Friday, October 3, 2008

junit.framework.JUnit4TestCaseFacade signer issue in Eclipse

When running a junt test in Eclipse (Ganymede), I got the following exception:

java.lang.SecurityException: class "junit.framework.JUnit4TestCaseFacade"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)

It looks like the problem is because the Eclipse is using Junit 4. As soon as I switched it to Junit 3, it works fine.

To switch from Junit 4 to Junit 3. Click "Run" -> "Run configurations..."->"Test runner".

9 comments:

Unknown said...

Help me a lot! thx!

Misiaque said...

It's not very helpful if you use JUnit4 tests, unfortunately...

Misiaque said...

I've found better solution:

Just make sure that JUnit4 libraries are at the beginning of your classpath.
In other words:
1. Project/Build Path/Configure Build Path
2. Order and Export tab
3. Move JUnit4 on top.

Works for me :-)

BLANK said...

Thank you Misiaque, the steps you mentioned sure helped.

sireesha said...

thanx Misiaque.its help me a lot

Arun Rai said...

Hi Misiaque ,It helped a lot...Thanks

Arun Rai said...

Hi Misiaque it helped a lot thanks

Suji said...

thanks a lot....

one more thing am getting error like this how to solve this

java.lang.NoClassDefFoundError: com/google/common/base/Charsets
at com.thoughtworks.selenium.HttpCommandProcessor.getOutputStreamWriter(HttpCommandProcessor.java:149)
at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:176)
at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:118)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:101)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
at com.GcdTest.setUp(GcdTest.java:11)
at junit.framework.TestCase.runBare(TestCase.java:132)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:248)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
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)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Charsets
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 23 more

Suji said...

plz help me
i got struck