2

How do I know what I do wrong?

I have a glassfish JPA JSF project and I'm currently adding security with jdbc.

WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception

What additional information is needed to help me?

if I use the SHA256 I get:

SEVERE: SEC1111: Cannot load group for JDBC realm user [admin]. WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception

my login code:

            <form method="POST" action="j_security_check">
            Username: <input type="text" name="j_username" value="#{kwetterbean.name}"/>
            Password: <input type="password" name="j_password" value="#{kwetterbean.password}"/>               
            <input type="submit" value="Login" />
            <input type="reset" value="Reset" />
        </form>
Aldwoni
  • 1,168
  • 10
  • 24
  • The actual exception stacktrace, the configuration changes you made, any code you wrote to do the login, ... – Gimby Feb 25 '14 at 15:33
  • 1
    possible duplicate of [LoginException: Login failed: Security Exception](http://stackoverflow.com/questions/7941713/loginexception-login-failed-security-exception) – Shoaib Chikate Feb 25 '14 at 15:34
  • http://stackoverflow.com/questions/14181111/javax-security-auth-login-loginexception-security-exception – Shoaib Chikate Feb 25 '14 at 15:35
  • @Gimby, where can I get the exception stacktrace? I can not find more :( The code from the login comes from: http://java.dzone.com/articles/jdbc-realm-and-form-based, I only use JPA instead of direct database connection – Aldwoni Feb 25 '14 at 15:51
  • @ShoaibChikate, The answer of the other question doesn't answer it :( – Aldwoni Feb 25 '14 at 15:52
  • If its not in the server logs, some code must be swallowing it. You are ignoring the rest of my comment; if you don't share what you did, its going to be hard to pin down what you should be doing to fix stuff. – Gimby Feb 25 '14 at 15:54
  • As I said I tried to follow java.dzone.com/articles/jdbc-realm-and-form-based. Which part is the most likely to have it? Than I can give the code of that part, as last time, the website complained about I posted to much code. I posted the login code as you requested – Aldwoni Feb 25 '14 at 16:09
  • I think it has something to do with the database, how can I best add the database to this site? – Aldwoni Feb 26 '14 at 09:33

1 Answers1

2

Though this was asked a long time ago, it could be helpful to someone just viewing it now. I had a similar error message and this is how I solved it. Here's what to do. Under the services tab in NetBeans, locate servers and Right-click on the glassfish server and select view admin console. This will launch the glassfish admin console on your default browser. Under "configurations", click "server-config", then "security" and then "realms" . On the pane that displays on the right hand, click "new". Then you fill the details. Basically, that page tells glassfish server where the user table is in the database, the column/field that is used as the username, the name of the table that has the users group, the name of the password field/column, the kind of encryption that is used. Don't forget to also fill the digest algorithm (this is usually the same with the one you filled in the password encryption algorithm). If you are not using any encryption method in saving the passwords, you can enter "None". you can also watch this on youtube link https://www.youtube.com/watch?v=a-hUUTHOzsY

norbert
  • 29
  • 6