2015-09-18 137 views
2

當我執行我的代碼時,出現以下錯誤。 後,我從JDK 1.6中的字節代碼它將使方面升級到1.8java.lang.LinkageError:接口初始化時加載器約束違規

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) 

回答

3

的Java 8是嚴格這正在發生。一些模擬工具使用了一些不尋常的字節碼工具。

最有可能的解決辦法是因爲它很可能已得到修復與Java 8

+0

我正在使用powermock-api-mockito的最新版本1.6.2。 – Vijay

+0

也許檢查他們的bugtracker呢? – the8472

2

使用註釋@PowerMockIgnore工作升級powermock(「javax.security。*」)在測試用例解決我的測試用例失敗。

+0

這是爲我做的! – FrustratedWithFormsDesigner

相關問題