GlassFish tip: Broken or Corrupted domain.xml

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 :
%asadamin 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.

Comments:

...the proposed solution is to reinstall Glassfish?

Posted by guest on août 31, 2007 at 07:21 AM CEST #

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.

Posted by Alexis MP on août 31, 2007 at 03:03 PM CEST #

Post a Comment:
Comments are closed for this entry.
About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder