我正在尝试使用jdbc realm文件来管理我的Web应用程序的安全性。但是当我使用一个简单的领域文件时,它可以很好地工作,但是当我使用Realm文件JDBC时,我总是会遇到连接失败的错误。
我使用 glassfish5.0(build25)和 JSF2.2
文件领域: 对于组表我使用包含电子邮件,密码和组名的视图。要测试我的配置,我为密码加密设置无
login.jsp
<form class="form-signin" action="j_security_check" method="post">
<img src="/RepairMyShip/faces/javax.faces.resource/img/logo_black_v2.png" />
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<label for="inputName" class="sr-only">Username</label>
<input name="j_username" type="text" id="inputName" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input name="j_password" type="password" id="inputPassword" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<p class="mt-5 mb-3 text-muted">Repair my 'ship © 2017-2018</p>
</form>
更新 日志文件
Infos: Initializing Soteria 1.0 for context '/RepairMyShip'
Infos: Initialisation de Mojarra 2.3.2 ( 20170627-2139 e63598abf2ed2bb1a24674f308a734e0dce18a72) pour le contexte «/RepairMyShip»
Infos: Monitoring jndi:/server/RepairMyShip/WEB-INF/faces-config.xml for modifications
Avertissement: JSF1025 : [/RepairMyShip] le paramètre d’initialisation du contexte «facelets.SKIP_COMMENTS» est désapprouvé. Cette option sera toujours configurée, mais à l’avenir, utilisez «javax.faces.FACELETS_SKIP_COMMENTS».
Infos: JSF1020 : [/RepairMyShip] option de configuration «javax.faces.FACELETS_SKIP_COMMENTS» réinitialisée sur Activée
Infos: Loading application [RepairMyShip] at [/RepairMyShip]
Infos: RepairMyShip was successfully deployed in 2 603 milliseconds.
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/index.xhtml loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Avertissement: JSF1091 : Aucun type mime détecté pour le fichier /login.jsp. Pour résoudre ce problème, ajoutez un mappage mime-type au fichier web.xml de l’application.
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/css/jsfcrud.css loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/css/cover.css loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/img/logo_v2.png loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/img/background_accueil.jpg loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/posts/List.xhtml loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/css/signin.css loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/img/logo_black_v2.png loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/img/background_login_2.jpg loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/posts/j_security_check loginPage: /login.jsp
Précis: Allow access to username/password submission
Précis: Tomcat callback for authenticate user/password
Précis: usename = kiki@kiki.com
Avertissement: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception
Précis: Exception
com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception
at com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:396)
at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:241)
at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:154)
at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:705)
at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:646)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:273)
at org.apache.catalina.authenticator.AuthenticatorBase.processSecurityCheck(AuthenticatorBase.java:986)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:572)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:620)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.security.auth.login.LoginException: Security Exception
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:840)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
at com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:383)
... 32 more
Caused by: java.lang.SecurityException
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:841)
... 39 more
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/css/signin.css loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security][ hasUserDataPermission ] Principal: null ContextPath: /RepairMyShip
Précis: [Web-Security] requestURI: /faces/javax.faces.resource/img/background_login_2.jpg loginPage: /login.jsp
Précis: [Web-Security] [ hasResourcePermission ] Principal: null ContextPath: /RepairMyShip