views:

454

answers:

2

I have a fairly typical JavaEE application, composed using EJB3, seam components, spring beans and JSF, all packaged into several jar and war files inside an ear file. Naturally for JavaEE, we have many XML files as part of the application. Some of these XML files are validated using DTD (seam) and some using schema.

As most files where taken from the examples and from other projects, all DTDs and schemas refer to the project's site, where the default DTD or schema resides. Here comes the problem: For some reason, the JBoss site misses the seam DTDs today (Check http://www.jboss.com/products/seam/components-1.1.dtd, http://www.jboss.com/products/seam/components-1.2.dtd, http://www.jboss.com/products/seam/components-2.0.dtd). Since the JBoss server validates the XML at bootstrap using this location, the application deployment failed.

My question is this: Given this case, where should I put the DTD and definition files? I see three options:

  1. Use the default location, as I did before. As it means I now add the stability of the JBoss, Sun, Spring and any other vendor into my system in case I need to re-deploy the application, I prefer not to do so.
  2. Copy all DTD and schema files to my server, having the URLS point to a server under my control.
  3. Copy all DTD and schema files to my application or app server, and use them locally.

I tend to use option #3, as it provides full control on the files, without network dependencies. In test we've done, it even significantly reduced the bootstrap time of the server - apperently the XML parser does not cache the definitions. Is there anyhing I miss by taking this path?

A: 

Nope this is the right thing to do. The first should only be used to mess around or play with code but not for anything serious and the second has no advantage over the third and is more complicated at the same time.

MahdeTo
A: 

The real question is: Do you really need to validate the xml files? In the most cases, validation are not done in production code -- it is just too slow most of the time.

If you really want to validate, go for option #3.

J-16 SDiZ
How do I turn off validation in JBoss? I am not the one who calls the XML parser.
David Rabinowitz