Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

java-8

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)
like image 285
Vijay Avatar asked Jun 22 '26 01:06

Vijay


2 Answers

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

like image 150
Vijay Avatar answered Jun 23 '26 15:06

Vijay


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.

like image 41
Peter Lawrey Avatar answered Jun 23 '26 15:06

Peter Lawrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!