我试图让我的登录表单与MySQL数据库,并不断收到以下错误:重度:jdbcrealm.invaliduserreason WEB9102:网页登录失败
[更新] - >我今天做了一些修改这是我现在得到的:
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
这就是我从堆栈跟踪得到的。我下面这个教程:http://blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html
这是在GlassFish-web.xml中我映射:
<security-role-mapping>
<role-name>user</role-name>
<group-name>user</group-name>
</security-role-mapping>
这是我的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>
这是我的登录表单:
<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>
这是我在服务器中设置领域的屏幕截图。我目前没有使用加密来简化事情:
由于我没有其他任何东西在堆栈中,但我上面发布。我真的不确定有什么问题。如果有人能朝正确的方向推动,我将不胜感激。
你找到解决方案吗?我的问题和你几乎一样,但皮埃尔的回答对我来说并不合适。 –
我做了皮埃尔C.在这篇文章的答案中提出的建议。此外,重复了这个教程两次,并在算法字段中使用'None',我能够弄明白。教程的链接是:[jdbc-security-realm-and-form-based](http:// blog .eisele.net/2011/01/jdbc-security-realm-and-form-based.html) – lv10