Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerMockito 1.6.5 throws java.lang.SecurityException signer information mismatch #704

Closed
csorbazoli opened this issue Oct 20, 2016 · 2 comments

Comments

@csorbazoli
Copy link

csorbazoli commented Oct 20, 2016

I was using PowerMockito 1.6.2 which was working fine except that I had no coverage reports on test classes which were using PowerMockito.
I've check the suggested solutions and I successfully get the coverage reports working when I was switching to version 1.6.5. It is working well even without using the PowerMockAgent.
I was very pleased to see but now I'm facing the issue that junit tests failed to initialize if in the PrepareForTest annotation affects also classes which have signatures.
E.g. I get this stacktrace:
java.lang.SecurityException: class "org.eclipse.core.runtime.IAdaptable"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(ClassLoader.java:895) at java.lang.ClassLoader.preDefineClass(ClassLoader.java:665) at java.lang.ClassLoader.defineClass(ClassLoader.java:758) at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:250) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:194) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:71) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:250) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:194) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:71) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760)

Strange is that it was working without any problems with the previous version.
I've search StackOverFlow for solution but no success. I suspected that this is related to cglib or javassist, so I tried to use the older versions, but it did not help.
When I change powermock-mockito-1.6.2-full.jar to powermock-mockito-1.6.5-full.jar then this error appears.

How can I avoid this error message?
Should I remove the signature information from the referenced libraries? Or are there any other option or hidden feature to avoid the signature problem?

I'm running my dev environment on Windows7, with Eclipse Mars.

@thekingn0thing
Copy link
Member

thekingn0thing commented Oct 24, 2016

It's a result of fixing issue #564 with Jacoco, where was added passing protection domain for mocked classes when a class is modified, as result we pass certificate of original class also.

I'll try to fix it.

@csorbazoli
Copy link
Author

Thank you, Arthur.

thekingn0thing pushed a commit that referenced this issue Nov 1, 2016
…ormation mismatch

Pass protection domain for mocked classes
thekingn0thing added a commit that referenced this issue Nov 1, 2016
…ormation mismatch (#712)

Pass protection domain for mocked classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment