By alexismp on août 31, 2007
This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.
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 :
• restore the entire domain :
...if you had previously backed it up :
• 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.