java 严重:jdbcrealm.invaliduserreason WEB9102:Web 登录失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11007071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SEVERE: jdbcrealm.invaliduserreason WEB9102: Web Login Failed
提问by lv10
I'm trying to get my login form to with a MySQL Database and keep on getting the following error:
我正在尝试使用 MySQL 数据库获取我的登录表单并继续收到以下错误:
[update] --> I made some modification today this is what I'm getting right now:
[更新] --> 我今天做了一些修改,这就是我现在得到的:
SEVERE: jdbcrealm.invaliduserreason
WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception
WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception
WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception
That's all I get from the stack trace. I'm following this tutorial: http://blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html
这就是我从堆栈跟踪中得到的全部信息。我正在关注本教程:http: //blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html
This is my mapping on glassfish-web.xml:
这是我在 glassfish-web.xml 上的映射:
<security-role-mapping>
<role-name>user</role-name>
<group-name>user</group-name>
</security-role-mapping>
This is my web.xml:
这是我的 web.xml:
<security-constraint>
<display-name>user</display-name>
<web-resource-collection>
<web-resource-name>Users Area</web-resource-name>
<description>Protected Users Area</description>
<url-pattern>/user/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>POST</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jdbcRealm</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login-error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>user security role</description>
<role-name>user</role-name>
</security-role>
This is my login form:
这是我的登录表单:
<form action="j_security_check" class="form" method="post">
<p class="email">
<input type="text" name="j_username" id="j_username"/>
<label for="j_username">E-mail / Username</label>
</p>
<p class="pwd">
<input type="password" name="j_password" id="j_password" />
<label for="j_password">Password</label>
</p>
<p class="submit">
<input name="login" type="submit" value="Login" />
<input name="reset_pwd" type="submit" value="Reset Password">
</p>
</form>
This a screenshot of my realm setup in the server. I didn't use encryption to simplify things for the moment:
这是我在服务器中设置的领域的屏幕截图。我暂时没有使用加密来简化事情:
Since I have nothing else in the stack but what I posted above. I'm really not sure what's wrong. I would appreciate if anyone can me a push in the right direction.
因为除了我上面发布的内容之外,堆栈中没有其他任何内容。我真的不确定出了什么问题。如果有人能推动我朝着正确的方向前进,我将不胜感激。
回答by Pierre C
In your jdbcRealm setup in Glassfish, be sure to write "none" in the Algorithm (instead of SHA-256 or anything else). If you leave the field blank, it won't work.
在 Glassfish 的 jdbcRealm 设置中,确保在算法中写入“none”(而不是 SHA-256 或其他任何内容)。如果您将该字段留空,它将不起作用。
Hope this helps...
希望这可以帮助...
回答by Varuna Singh
Silly and neat thing that fixed it for me; Realms were small letters esp in table and coloumn names, where they were caps in my mysql db. Remember to check your case sensitivity of your tables in your Realms.
为我修好它的愚蠢而整洁的东西;领域是表和列名称中的小写字母,尤其是在我的 mysql 数据库中它们是大写字母。请记住检查 Realms 中表格的大小写敏感性。
回答by mlago
If you are using Glassfish 4 you need to complete the fields Database User and Database Password, which appears in Settings -> server-config -> Security -> Realms -> (jdbcRealm)
如果您使用的是 Glassfish 4,则需要填写“数据库用户”和“数据库密码”字段,它们出现在设置 -> 服务器配置 -> 安全性 -> 领域 -> (jdbcRealm)