Vijay
Vijay

Reputation: 123

java.lang.LinkageError: loader constraint violation in interface itable initialization

When I am executing my code, I am getting the below error. This is happening after I upgraded from JDK 1.6 to 1.8

java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "javax.security.auth.kerberos.JavaxSecurityAuthKerberosAccessImpl.keyTabTakeSnapshot(Ljavax/security/auth/kerberos/KeyTab;)Lsun/security/krb5/internal/ktab/KeyTab;" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl, and the class loader (instance of <bootloader>) for interface sun/security/krb5/JavaxSecurityAuthKerberosAccess have different Class objects for the type javax/security/auth/kerberos/KeyTab used in the signature
    at javax.security.auth.kerberos.KeyTab.<clinit>(KeyTab.java:100)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:609)

Upvotes: 3

Views: 3253

Answers (2)

Vijay
Vijay

Reputation: 123

Using annotation @PowerMockIgnore("javax.security.*") in the test cases resolved the failure of my test cases.

Upvotes: 5

Peter Lawrey
Peter Lawrey

Reputation: 533492

Java 8 is stricter in terms of the byte code it will allow. Some mocking tools used some unusual byte code instrumentation.

Most likely the fix is to upgrade your powermock as it will most likely have been fixed to work with Java 8.

Upvotes: 3

Related Questions