LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2008, 07:12 AM   #1
ptemmerman
Member
 
Registered: Oct 2008
Location: Spain
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
DTD files


Hi All,

This isn't really a Linux related question, but I thought I'd ask it anyway, since this will be probably very basic for most people.

I just had a colleague coming up to me saying that there Tomcat application won't start because it has no internet connectivity.
The Tomcat server is unable to retrieve the dtd files from java.sun.com.

As far as I know, the DOCTYPE specifiers (example below) are only being used to identify which type of document the parser is working with, rather than for validation purposes.

Quote:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
Thus it seems rather strange to me that Tomcat would be actually trying to fetch those dtd's from the internet.

However, if somebody could confirm this, then I can rest assured

Thanks
 
Old 11-23-2008, 02:45 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You're correct - Tomcat is *not* trying to fetch stuff from Internet just because of the DOCTYPE definition. Your colleague is mistaken.

"http://java.sun.com/dtd/web-app_2_3.dtd" is a "URN" (Universal Resource Name). It's only purpose is to provide a unique namespace, *not* to actually fetch something from the Internet.

The details are in RFC 3151:

http://www.faqs.org/rfcs/rfc3151.html
 
Old 11-24-2008, 02:24 AM   #3
ptemmerman
Member
 
Registered: Oct 2008
Location: Spain
Distribution: Ubuntu
Posts: 75

Original Poster
Rep: Reputation: 15
Thank you very much
 
Old 11-24-2008, 10:41 AM   #4
ptemmerman
Member
 
Registered: Oct 2008
Location: Spain
Distribution: Ubuntu
Posts: 75

Original Poster
Rep: Reputation: 15
UPDATE:

It actually seems that it's only partially true.
The parser tries to validate the document using the doctype specification. The thing is that it first tries to look for the dtd in the jar using the DTD name. If this fails, then the dtd is fetched from the URL.

Quote:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
In this case, it would first try to find //Sun Microsystems, Inc.//DTD Web Application 2.3// in some location (don't ask me where..maybe in JDK's jars or something). If this is not being found, then it tries to fetch from the URL.

I was able to reproduce this by altering the DTD name to something bogus, i.e. //SunZZZZ MicrosystemsZZZ, Inc.//DTD Web Application 2.3//
My packet sniffer showed me that the it connected to the sun website.

If anybody has a better understanding of this and would like to share it..feel free to do so.
 
Old 11-24-2008, 11:49 AM   #5
salter
Member
 
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
If the basic problem is about running a tomcat a tomcat application without worldwide connection, than the practical approach would be to copy the DTD to the local PC and modify/or to modify the DOCTYPE url.

This DOCTYPE behaviour is actually not specific to tomcat - it's the same behaviour as with all SGML-based marked-up contents (HTML, XML, etc): if a DOCTYPE needs to defined, then use one that can be accessed.

This problem doesn't show up for HTML documents, because all sane browsers will have a default DOCTYPE setting if the HTML doesn't provide one, and that default is either part of the browser code or it is installed along with it. So you never have this problem during offline browsing.

It seems that tomcat doesn't declare anything as default on it's own, but rather tries to access any DTD at the given url.

Last edited by Tinkster; 10-30-2010 at 06:18 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xml and DTD kshkid Programming 4 04-05-2008 07:10 AM
could not locate docbookx.dtd for DocBook XML dombrowsky Linux - Software 6 02-14-2006 03:39 AM
failed compiling in kdevelop3: missing file kdex.dtd sanmartin Linux - Software 0 12-16-2005 02:48 PM
DocBook DTD merchtemeagle Slackware 1 09-29-2005 12:57 PM
dtd dicer-toaster daemon dutch1918 Linux - Networking 5 07-31-2005 01:52 PM


All times are GMT -5. The time now is 06:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration