Generates a new self-signed certificate in the specified server configuration.


asadmin generate-self-signed-certificate [--help]


This command can generate a self-signed certificate for an instance, placing the resultant key pair in the target instance or listener’s keystore and truststores.

If the instance or listener is configured to use the default keystore and truststore, the command will instead synchronize the instance with the DAS (under the assumption the certificate has been added to the default key and trust store of the DAS), since any certificates added to the instance stores would be lost upon next synchronisation.

This command will not overwrite an entry already present in the keystore with the same alias. In this scenario no certificate is generated and the command exits.
In the case however where there is not an entry with the same alias in the key store but there is in the trust store, a certificate will be generated and the entry in the trust store will be overwritten.



Displays the help text for the subcommand.


This option helps specify the target on which you are generating the certificate. Valid values are:


Applies to the default server instance. This is the default value.


Applies to every server instance in the cluster.


Applies to a specified sever instance.


Whether the HTTP listeners should be reloaded. Defaults to false


The name of the HTTP or IIOP listener to add the certificate to.


The name of the domain where the target instance exists.

Defaults to domain1 or the existing domain if only one exists.


The path to the directory containing the target domain.

Defaults to as-install/glassfish/domains


The name of the node where the target instance exists.

Defaults to localhost-$domainname


The path to the directory containing the target node.

Defaults to as-install/glassfish/nodes


The distinguished name (DN) to use when generating the certificate.


The semicolon (;) separated list of additional Subject Alternative Names to add to the generated certificate.



The alias name to use when generating the certificate and storing it in the keystore and truststores.


Example 1 Generate a new self-signed certificate under the test-cert alias

asadmin generate-self-signed-certificate --dn ",IP=" --listener http-listener-2 --alternativenames ";,IP:," --target Instance1 test_cert

Exit Status


subcommand executed successfully


error in executing the subcommand

See Also