domain.xml (located in GLASSFISH_INSTALL/domain/DOMAIN_NAME/config
) is a key configuration file in GlassFish and it should never be edited by hand. So now that I’ve said this, I’d be lying if I said I never did this myself. And yes I’ve had times when my config file was corrupted which would prevent GlassFish from starting. If you end up with a corrupted domain.xml
file *without* editing it by hand (never happened to me), you have one thing to do: file a bug with steps to reproduce.
If for some reason domain.xml
is indeed corrupted (malformed XML or not compliant to the associated DTD), here are a few things you can do before or after the corruption:
• run the following command to verify the correctness of the file :
% asadmin verify-domain-xml
• restore the entire domain :
% asadmin restore-domain
…if you had previously backed it up :
% asadmin backup-domain
• if you’re happy losing all domain configuration (deployed applications, JDBC resources, JVM options, …) or desperately want to get back to a working domain, you can create a new one :
% asadmin create-domain domain-name
…or recreate default domain1
by first deleting it :
% asadmin delete-domain domain1
and running the setup script again from the root directory (GlassFish 2.x only) :
% ant -f setup.xml
You can also try to fix the content of this config file with a smart XML editor providing code completion, color syntaxing and well-formeness verification based on its DTD. If you’re using NetBeans, go to “DTDs and XML Schema Catalogs”. If you’re using GlassFish 3 and above, you probably want to read why there is no longer a DTD/Schema.
…the proposed solution is to reinstall Glassfish?
You really shouldn’t have to get to that point but the initial person asking about this is learning Java EE, so that wasn’t really a problem. Backuping your domain is really what you should be doing.