SEVERE: jdbcrealm.invaliduserreason WEB9102: Web Login Failed


I'm trying to get my login form to with a MySQL Database and keep on getting the following error:

[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: <a href="http://blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html" rel="nofollow">http://blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html</a>

This is my mapping on glassfish-web.xml:

<security-role-mapping> <role-name>user</role-name> <group-name>user</group-name> </security-role-mapping>

This is my 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 class="pwd"> <input type="password" name="j_password" id="j_password" /> <label for="j_password">Password</label>

<p class="submit"> <input name="login" type="submit" value="Login" /> <input name="reset_pwd" type="submit" value="Reset Password">


This a screenshot of my realm setup in the server. I didn't use encryption to simplify things for the moment: <img alt="Realm" class="b-lazy" data-src="https://i.stack.imgur.com/2WijQ.png" data-original="https://i.stack.imgur.com/2WijQ.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

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.


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.

Hope this helps...


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.


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)

<a href="http://i.stack.imgur.com/QLk0c.png" rel="nofollow">enter image description here</a>


  • Input fields not clearing after the validation fails
  • Get Device IMEI BB10 C++/QML
  • Fatal error HelperSet not found when setting up Doctrine Console (with CodeIgniter)
  • Use Java program from Python
  • Column Nullability/Optionality: NULL vs NOT NULL
  • Joining Model with Table Laravel 5.2
  • if I want to find what's referencing an object in SQL Server, is searching syscomments comprehe
  • Yii2 Login with database
  • How to Model Ternary Relationship in CakePhp?
  • Action Pack components in Rails
  • Where these are stored?
  • In Java, how can I construct a File from a resource?
  • abstracting over a collection
  • How can I tell a form not to dispose a particular control when it closes?
  • JBoss External Properties Files in Classpath
  • Button click event not firing in jQuery
  • Use of this Javascript
  • C++ Partial template specialization - design simplification
  • Launch Runnable Jar from Web Start
  • Read text file and split every line in MSBuild
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • ActionScript 2 vs ActionScript 3 performance
  • To display the title for the current loaction in map in iphone
  • How to get next/previous record number?
  • Traverse Array and Display in markup
  • retrieve vertices with no linked edge in arangodb
  • Python: how to group similar lists together in a list of lists?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • How to set the response of a form post action to a iframe source?
  • embed rChart in Markdown
  • Authorize attributes not working in MVC 4
  • EntityFramework adding new object to nested object collection
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • Python/Django TangoWithDjango Models and Databases
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF