gpt4 book ai didi

java - Jaas 基本身份验证 tomcat 7

转载 作者:行者123 更新时间:2023-11-28 22:20:56 24 4
gpt4 key购买 nike

我不断收到同样的错误,我已经更改了指定jaas配置文件位置

        javax.security.auth.login.LoginException: No LoginModules configured for    JaaSExample:
at javax.security.auth.login.LoginContext.init(LoginContext.java:273)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:514)
at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:417)
at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:356)
at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:146)
at org.apache.catalina.realm.LockOutRealm.authenticate(LockOutRealm.java:180)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:166)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:574)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

我已经将这个 tom 添加到我的 tomcat7w.exe 文件中。

    -Djava.security.auth.login.config=C:\Program Files (x86)\Apache Software                 Foundation\Tomcat 7.0\conf\jaas.config

还有一个就是我也有这个境界

    <Realm className="org.apache.catalina.realm.JAASRealm" 
appName="JaaSExample"
userClassNames="Security.UserPrincipal" roleClassNames="Security.RolePrincipal" />

那我错过了什么?请帮助我,

我使用的是 netbeans,tomcat 7.0.47。

thank you very much,

我决定使用 glassfish!

最佳答案

根据 http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JAASRealm

您应该为 Java 设置一个 login.config 文件,并通过将其位置指定给 JVM 告诉 Tomcat 在哪里可以找到它,例如通过设置环境变量:JAVA_OPTS=$JAVA_OPTS -Djava.security.auth .login.config=$CATALINA_BASE/conf/jaas.config

已添加

对于 Windows,打开 startup.bat 添加以下行:set JAVA_OPTS=%JAVA_OPTS% -Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config after okHome

例如

set JAVA_OPTS=%JAVA_OPTS% -Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config
set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"

关于java - Jaas 基本身份验证 tomcat 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19907421/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com