May 25, 2017

How to recover / reset Glassfish admin password

Replace the file "admin-keyfile" under "/installation-folder/glassfish/domains/domain1/config/" or "${com.sun.aas.instanceRoot}/config/admin-keyfile" with same of any of working domains file.
"admin-keyfile" is under "/installation-folder/glassfish/domains/domain1/config/" or "${com.sun.aas.instanceRoot}/config/admin-keyfile". It maybe different if this configuration has been customized. You can see it at admin console, normally at http://localhost:4848

Go to section Configurations → server-"→ Realms →admin-realm
The default configuration is: fileRealm  ${com.sun.aas.instanceRoot}/config/admin-keyfile
You can directly see it in domain.xml too.

So that password will be same used in domains used earlier and you may change the password once after the login.

The content of admin-keyfile for password "changit" is:

admin;{SSHA256}dvCEGFNHGtSyXIhJvwR5FnviH+u8fCadrUIqp6uJc1tP9Bv10CGT7A==;asadmin

The content of admin-keyfile for empty password is:

admin;{SSHA256}2GiTMM0n4ulpMfRaMPMImYvVF522XY6nW2cKSXoY1EoM2QlHrHUkDQ==;asadmin