You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Artur Rataj <ar...@gmail.com> on 2007/07/07 11:26:41 UTC

Context.xml error

Hello. I added a second context to Context.xml:

<Context reloadable="true" privileged="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

<Context path="/informacja_ekspresowa"
docBase="/home/library/islib/Informacja_Ekspresowa/"
        reloadable="true">
</Context>


and tomcat stopped to work:


2007-07-07 11:23:06 org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 20 column 2: The markup in the
document following the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document following
the root element must be well-formed.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(XMLDocumentScannerImpl.java:1394)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
        at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:800)
        at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:736)
        at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1005)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5297)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4070)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2007-07-07 11:23:06 org.apache.catalina.startup.ContextConfig
processContextConfig
SEVERE: Parse error in context.xml for /docs
org.xml.sax.SAXParseException: The markup in the document following
the root element must be well-formed.
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
        at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:800)
        at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:736)
        at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1005)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5297)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4070)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2007-07-07 11:23:06 org.apache.catalina.startup.ContextConfig
processContextConfig
SEVERE: Occurred at line 20 column 2


Could you tell me why?

Best regards,
Artur

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Context.xml error

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Juha Laiho [mailto:Juha.Laiho@iki.fi] 
> Subject: Re: Context.xml error
> 
> Looking at that the context data you posted, at least the
> first one is missing the path="/..." attribute (which is
> required to be unique for all context within a given host
> -- and I think this requirement makes the path attribute
> mandatory as well).

Please note the following in the doc for the path attribute:

"The value of this field must not be set except when statically defining
a Context in server.xml, as it will be inferred from the filenames used
for either the .xml context file or the docBase."

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context.xml error

Posted by Juha Laiho <Ju...@iki.fi>.
Artur Rataj wrote:
> Hello. I added a second context to Context.xml:
> 
> <Context reloadable="true" privileged="true">
> <WatchedResource>WEB-INF/web.xml</WatchedResource>
> </Context>
> 
> <Context path="/informacja_ekspresowa"
> docBase="/home/library/islib/Informacja_Ekspresowa/"
>        reloadable="true">
> </Context>
> 
> 
> and tomcat stopped to work:
> 
> 
> 2007-07-07 11:23:06 org.apache.tomcat.util.digester.Digester fatalError
> SEVERE: Parse Fatal Error at line 20 column 2: The markup in the
> document following the root element must be well-formed.
> org.xml.sax.SAXParseException: The markup in the document following
> the root element must be well-formed.

...

> 2007-07-07 11:23:06 org.apache.catalina.startup.ContextConfig
> processContextConfig
> SEVERE: Parse error in context.xml for /docs
> org.xml.sax.SAXParseException: The markup in the document following
> the root element must be well-formed.
...


> 2007-07-07 11:23:06 org.apache.catalina.startup.ContextConfig
> processContextConfig
> SEVERE: Occurred at line 20 column 2
> 
> 
> Could you tell me why?

Hmm.. could you tell which of the lines is line 20 in context.xml for /docs?

Looking at that the context data you posted, at least the first one is
missing the path="/..." attribute (which is required to be unique for all
context within a given host -- and I think this requirement makes the
path attribute mandatory as well).
-- 
..Juha

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Context.xml error

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Artur Rataj [mailto:arturrataj@gmail.com] 
> Subject: Re: Context.xml error
> 
> But is not url-pattern defining the page address, and not a 
> listed directory?

The DefaultServlet - the one that produces directory listings - treats
the URI path as a webapp subdirectory.

> Also, would not the page address still be under /library/*, and not
> under /files?

The directory being listed must be part of the webapp's directory
structure.  If you want to allow directory listings for some location
totally outside of a webapp, you must create a second, separate,
independent webapp for the directory structure to be listed.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context.xml error

Posted by Artur Rataj <ar...@gmail.com>.
On 7/10/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > From: Artur Rataj [mailto:arturrataj@gmail.com]
> > Subject: Re: Context.xml error
> >
> > I have a web app that has servlets on /library/*, and want tomcat to
> > also display some directory listing under /files or something like
> > that.
>
> Directory listings are handled by the DefaultServlet, normally
> controlled by the value of the listings parameter in the <servlet>
> declaration in Tomcat's conf/web.xml file.  This should be set to false
> to prevent obtaining listings from arbitrary directories.  In your
> webapp's WEB-INF/web.xml, try adding another <servlet> declaration with
> a different <servlet-name> but the same <servlet-class> as the normal
> DefaultServlet, and set its listings parameter to true.  Then add a
> <servlet-mapping> for your renamed DefaultServlet with a <url-pattern>
> that covers just the directories you want to display.

But is not url-pattern defining the page address, and not a listed directory?
Also, would not the page address still be under /library/*, and not
under /files?


Artur

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Context.xml error

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Artur Rataj [mailto:arturrataj@gmail.com] 
> Subject: Re: Context.xml error
> 
> I have a web app that has servlets on /library/*, and want tomcat to
> also display some directory listing under /files or something like
> that.

Directory listings are handled by the DefaultServlet, normally
controlled by the value of the listings parameter in the <servlet>
declaration in Tomcat's conf/web.xml file.  This should be set to false
to prevent obtaining listings from arbitrary directories.  In your
webapp's WEB-INF/web.xml, try adding another <servlet> declaration with
a different <servlet-name> but the same <servlet-class> as the normal
DefaultServlet, and set its listings parameter to true.  Then add a
<servlet-mapping> for your renamed DefaultServlet with a <url-pattern>
that covers just the directories you want to display.

(I haven't actually tried this, but I think it will work.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context.xml error

Posted by Artur Rataj <ar...@gmail.com>.
On 7/9/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
>
> What are you actually trying to accomplish?
>

I have a web app that has servlets on /library/*, and want tomcat to
also display some directory listing under /files or something like
that.


Artur

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Context.xml error

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Artur Rataj [mailto:arturrataj@gmail.com] 
> Subject: Re: Context.xml error
> 
> So, if an app has additional context for some directory listing, where
> it should be defined?

Your use of the terminology is in error.  An app is a context, and vice
versa; the phrase "app has additional context" is meaningless.

What are you actually trying to accomplish?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context.xml error

Posted by Artur Rataj <ar...@gmail.com>.
On 7/8/07, Mark Thomas <ma...@apache.org> wrote:
>
> Because each context.xml file can oly define a single context.
>

So, if an app has additional context for some directory listing, where
it should be defined?


Artur

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Context.xml error

Posted by Mark Thomas <ma...@apache.org>.
Artur Rataj wrote:
> Hello. I added a second context to Context.xml:
<snip/>
> and tomcat stopped to work:

Because each context.xml file can oly define a single context.

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org