jetty - LinkageError:org / eclipse / jetty / util / security / Credential的加载器约束违规

时间:2015-12-23 07:18:07

标签: jetty classloader jetty-9

我使用jetty JASS登录服务实现了自己的登录模块。创建我自己的登录模块,在jetty服务器上部署我的WAR文件。我已经扩展了jetty AbstractLoginModule 来实现或使用jetty jass登录服务。一旦你扩展了这一切,你需要做的就是实现它的 getUserInfo 方法。

我这样做的方式与此类似,

  @Override
    public UserInfo getUserInfo(String username) throws Exception {
        Credential credential = Credential.getCredential(username);
        List<String> roles = new ArrayList<String>();
        roles.add("**");        
        return new UserInfo(username, credential, roles);

    }

当没有部署jetty或使用任何https模块时,它工作正常,但是当我使用https模块时,它会引发链接错误,并且不允许我通过https或https连接。我的身份验证失败。

错误

    2015-12-23 12:34:00.053:WARN:oejj.JAASLoginService:qtp109961541-14:
javax.security.auth.login.LoginException: java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.jetty.jaas.spi.UserInfo.<init>(Ljav
a/lang/String;Lorg/eclipse/jetty/util/security/Credential;Ljava/util/List;)V" the class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) of the curren
t class, sigma/git/ctr/loginmodule/SigmaAALoginModule, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/eclip
se/jetty/jaas/spi/UserInfo, have different Class objects for the type org/eclipse/jetty/util/security/Credential used in the signature<|?at sigma.git.ctr.loginmodule
.SigmaAALoginModule.getUserInfo(SigmaAALoginModule.java:192)<|?at sigma.git.ctr.loginmodule.SigmaAALoginModule.login(SigmaAALoginModule.java:146)<|?at sun.reflect.Na
tiveMethodAccessorImpl.invoke0(Native Method)<|?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<|?at sun.reflect.DelegatingMethodAccessorImpl.invoke(U
nknown Source)<|?at java.lang.reflect.Method.invoke(Unknown Source)<|?at javax.security.auth.login.LoginContext.invoke(Unknown Source)<|?at javax.security.auth.login
.LoginContext.access$000(Unknown Source)<|?at javax.security.auth.login.LoginContext$4.run(Unknown Source)<|?at javax.security.auth.login.LoginContext$4.run(Unknown
Source)<|?at java.security.AccessController.doPrivileged(Native Method)<|?at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)<|?at javax.security.au
th.login.LoginContext.login(Unknown Source)<|?at org.eclipse.jetty.jaas.JAASLoginService.login(JAASLoginService.java:233)<|?at org.eclipse.jetty.security.authenticat
ion.LoginAuthenticator.login(LoginAuthenticator.java:61)<|?at org.eclipse.jetty.security.authentication.BasicAuthenticator.validateRequest(BasicAuthenticator.java:92

我还尝试在打包时排除所有UserInfo依赖项jar。我不能排除包含凭据类的jetty-util jar。如果我这样做会抛出NoClassDefFoundError。

请建议。

0 个答案:

没有答案