Why do I get errors when I run GlassFish off-line from the Internet? In fact, you can run GlassFish disconnected from the Internet. If you see errors deploying an application or restarting the server when it is disconnected, you might have misspelled the namespace URL or the system ID in an application's descriptor. For example, a sun-ejb-jar.xml descriptor that uses the incorrect DOCTYPE
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
instead of
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
(notice the extra "Sun ONE" in the first system ID) might work correctly (although more slowly) for a connected GlassFish server because it can retrieve the DTD over the Internet using the URL. But if the same server is later disconnected and has to parse that descriptor again it will be unable to do so. Disconnected servers can run because GlassFish has a local on-disk copy of the DTD and XSD files for the standard J2EE and Java EE descriptors and for the GlassFish-specific ones (currently in ${install-dir}/lib/dtds and .../schemas but these locations are subject to change). When GlassFish parses descriptors it locates the correct local copy of the DTD or schema using the system ID or namespace URL from the application's descriptor. If the descriptor does not refer to one of these known system IDs or namespace URLs, then GlassFish will not find a corresponding local copy of the DTD or XSD and will try to retrieve the file using the URL - that is, over the network. In that case, if GlassFish is running disconnected from the Internet it cannot reach the www.sun.com site and so will report errors during deployment or restart when it parses a descriptor. Why does this matter? Some GlassFish installations might need to run disconnected, ranging from a developer in the departure lounge of an airport all the way to a high-security installation that must be insulated from the outside world. GlassFish will work just fine this way...if the descriptors are correct.
|