2010/08/01

Solving java.lang.SecurityException when adding Hamcrest in Eclipse

Added the full version of Hamcrest 1.2 to my Eclipse project today and got a java.lang.SecurityException as soon as I tried to run my unit tests:

java.lang.SecurityException: class "org.hamcrest.Matchers"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(ClassLoader.java:807)

After some fruitless googling, I finally came across this post. Don't entirely follow the reference to plugins, but the intent seems pretty clear. After editing my project's build order so Hamcrest is before JUnit4, the problem went away. Definitely looking forward to trying out more Matcher style asserts in my unit tests.

1 comment:

  1. Exception is gone when changing ".classpath" as you've said. Thx.

    ReplyDelete