The solution to this problem is that your username/password stored in Netbeans for Glassfish does not match with what Glassfish expects. The default username/password is admin/adminadmin. Now if you change the password during installation, you would get the security exception error in the log. So change the password by right-clicking the Glassfish properties in Netbeans. If you forgot your password you need to reset it.
I had the same problem. I kept setting the glassfish password, then carefully entering it, and it would be rejected. Strangely, it would tell me several times and keep asking repeatedly.
I thought I was setting the password when I would change it in Netbeans, either by changing the properties of the Server or by removing & recreating the server (all 3 accessible through Tools Menu -> Servers). No! The password was set when Glassfish was installed (by default, admin is the user and adminadmin is the password).
That’s why it would ask me once for the password, then reject the answer twice. Netbeans had tried the password I had given it, then asked me, but I gave it the same answer.
To configure glassfish, use the web browser to access: http://localhost:4848/. You can change the p/w there! Then tell NetBeans what the password is, and it won't even trouble you for it anymore!