我試圖讓我的登錄表單與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