我正在尝试使用 MySQL 数据库获取我的登录表单并继续收到以下错误:
[更新] --> 我今天做了一些修改,这就是我现在得到的:
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>
这是我在服务器中设置的领域的屏幕截图。我暂时没有使用加密来简化事情:
因为除了我在上面发布的内容之外,我在堆栈中没有其他内容。我真的不确定出了什么问题。如果有人能推动我朝着正确的方向前进,我将不胜感激。