I successfully configured Glassfish to work with JDBCrealm using Basic Auth. But it's not working for Jsp page. My jsp page is simple using j_security_check and j_username and j_password. It throws me to UnAuthorizedAccess page (login error page). It's strange that it's working for basic auth and not for form based. What can be potential problem can anybody tell?

Also the structure of JDBCrealm table requirement is so ugly, i mean why is it so unnormalized? what if i want to change the structure? like

Users(Userid int, Username varchar(50), Userpassword varchar(50))

Roles(Roleid int, Rolename varchar(20))

UsersXRoles(UsersXRolesId int, UserId int, RoleId int)

??How should i configure this now?

Thanks in advance