Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > web.xml in servlet deployment - how to dummy out DOCTYPE

Reply
Thread Tools

web.xml in servlet deployment - how to dummy out DOCTYPE

 
 
Alexandr Molochnikov
Guest
Posts: n/a
 
      08-28-2003
Is there any way to deploy a servlet in Tomcat with web.xml file NOT having
DOCTYPE tag? If I do not specify it, the servlet starts, but Tomcat
generated the following error:

Aug 27, 2003 6:13:08 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 10 column 10: Document root element "web-app",
must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "web-app", must match
DOCTYPE root "null".
at
org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(U nknown Source)
....

However, if I do specify DOCTYPE, it wants me to put in a valid URL to the
DTD file - which I do not have/need. So, I am looking for a way to set
DOCTYPE to a dummy file just to keep the parser happy... with no success so
far.

Can it be done? Or am I on a wrong track altogether, and a valid DTD must be
in place, whether I like it or not?

Thanks for any help.

Alex Molochnikov
Gestalt Corporation


 
Reply With Quote
 
 
 
 
Darren Davison
Guest
Posts: n/a
 
      08-28-2003
Alexandr Molochnikov wrote:

> However, if I do specify DOCTYPE, it wants me to put in a valid URL to the
> DTD file - which I do not have/need. So, I am looking for a way to set
> DOCTYPE to a dummy file just to keep the parser happy... with no success
> so far.


it doesn't have to be an external URL, you can place it in your WEB-INF
directory and reference it as:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "/WEB-INF/web-app_2_3.dtd">

<web-app>
....
</web-app>


You can d/l the dtd file from Sun: <http://java.sun.com/dtd/web-app_2_3.dtd>


--
darren@ public key
davison|uk.net www.davison.uk.net/key.jsp
 
Reply With Quote
 
 
 
 
Alex Molochnikov
Guest
Posts: n/a
 
      08-28-2003
Thanks. I will give it a try tomorrow.

Alex.

"Darren Davison" <(E-Mail Removed)> wrote in message
news:3f4d99d1$0$192$(E-Mail Removed) t...
> Alexandr Molochnikov wrote:
>
> > However, if I do specify DOCTYPE, it wants me to put in a valid URL to

the
> > DTD file - which I do not have/need. So, I am looking for a way to set
> > DOCTYPE to a dummy file just to keep the parser happy... with no success
> > so far.

>
> it doesn't have to be an external URL, you can place it in your WEB-INF
> directory and reference it as:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN" "/WEB-INF/web-app_2_3.dtd">
>
> <web-app>
> ...
> </web-app>
>
>
> You can d/l the dtd file from Sun:

<http://java.sun.com/dtd/web-app_2_3.dtd>
>
>
> --
> darren@ public key
> davison|uk.net www.davison.uk.net/key.jsp


 
Reply With Quote
 
Alexandr Molochnikov
Guest
Posts: n/a
 
      08-28-2003
OK, I tried it... and the log says:

2003-08-28 10:44:03 ContextConfig[/StepForward] Parse error in application
web.xml
java.io.FileNotFoundException
at
org.apache.naming.resources.DirContextURLConnectio n.getInputStream(DirContex
tURLConnection.java:344)
at java.net.URL.openStream(URL.java:960)
....

The file is located in:
C:\Tomcat4.1\webapps\StepForward\WEB-INF\web-app_2_3.dtd

and web.xml contains this entry:

<!DOCTYPE web-app PUBLIC "Gestalt Corporation//EN"
"/WEB-INF/web-app_2_3.dtd">

Any ideas?

Thanks,

Alex.


"Darren Davison" <(E-Mail Removed)> wrote in message
news:3f4d99d1$0$192$(E-Mail Removed) t...
> Alexandr Molochnikov wrote:
>
> > However, if I do specify DOCTYPE, it wants me to put in a valid URL to

the
> > DTD file - which I do not have/need. So, I am looking for a way to set
> > DOCTYPE to a dummy file just to keep the parser happy... with no success
> > so far.

>
> it doesn't have to be an external URL, you can place it in your WEB-INF
> directory and reference it as:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN" "/WEB-INF/web-app_2_3.dtd">
>
> <web-app>
> ...
> </web-app>
>
>
> You can d/l the dtd file from Sun:

<http://java.sun.com/dtd/web-app_2_3.dtd>
>
>
> --
> darren@ public key
> davison|uk.net www.davison.uk.net/key.jsp



 
Reply With Quote
 
Sudsy
Guest
Posts: n/a
 
      08-29-2003
Alexandr Molochnikov wrote:
> OK, I tried it... and the log says:
>
> 2003-08-28 10:44:03 ContextConfig[/StepForward] Parse error in application
> web.xml
> java.io.FileNotFoundException
> at
> org.apache.naming.resources.DirContextURLConnectio n.getInputStream(DirContex
> tURLConnection.java:344)
> at java.net.URL.openStream(URL.java:960)
> ...
>
> The file is located in:
> C:\Tomcat4.1\webapps\StepForward\WEB-INF\web-app_2_3.dtd
>
> and web.xml contains this entry:
>
> <!DOCTYPE web-app PUBLIC "Gestalt Corporation//EN"

^
--------------------+

The type should be SYSTEM, not PUBLIC.

 
Reply With Quote
 
Alexandr Molochnikov
Guest
Posts: n/a
 
      08-29-2003
Thank you for looking into this. The solution was to not only use SYSTEM for
type, as you pointed out, but also to specify the file name without
preceding directory level:

<!DOCTYPE web-app SYSTEM "web-app_2_3.dtd">

I am a happy camper now!

Alex.

"Sudsy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> > <!DOCTYPE web-app PUBLIC "Gestalt Corporation//EN"

> ^
> --------------------+
>
> The type should be SYSTEM, not PUBLIC.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Newbie - CSS Works With Invalid DOCTYPE. Fails With Valid DOCTYPE. Larry Lindstrom HTML 19 06-12-2012 02:07 PM
new virus has cosed me out of my user account and made a dummy one Ragz Computer Support 8 10-27-2006 06:12 PM
Transforming DOM to file strips out DOCTYPE element O.B. Java 2 02-07-2006 10:14 AM
Enterprise Library deployment problem. Why needs to InstallUtil DLLs to the deployment server? If not, Registry Error whould shown. Benny Ng ASP .Net 0 10-03-2005 05:40 AM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM



Advertisments