tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, John" <JTur...@AAS.com>
Subject RE: Resources for a Context
Date Wed, 22 Jan 2003 19:39:40 GMT

To serve http://localhost:8080/myapp/index.html, all you need is the /myapp
Context element.  You don't need either of those Resources elements.  Using
them just confuses Tomcat.  I'm not sure what you want to do...if you want
to put index.html in c:\dev\proj1\web and have that be /myapp/index.html,
then you need to make c:\dev\proj1\web the docBase for your /myapp Context.

From: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/resources.html

"The Resources element represents the web application static resources, from
which classes will be loaded, HTML, JSP and the other static files will be
served. This allows the webapp to reside on various mediums other than the
filesystem, like compressed in a WAR file, in a JDBC database, or in a more
advanced versioning repository."

"A Resources element MAY be nested inside a Context component. If it is not
included, a default filesystem based Resources will be created
automatically, which is sufficient for most requirements."

John



> -----Original Message-----
> From: David Keyes [mailto:david.keyes@flashline.com]
> Sent: Wednesday, January 22, 2003 2:27 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Resources for a Context
> 
> 
> I am confused about what exactly <Resource> entries are 
> supposed to accomplish in Tomcat.  I have the following entry 
> in my server.xml file for Tomcat 4.0.6:
> 
> <Context path="/myapp" docBase="C:/test/">
>   <Resources 
> className="org.apache.naming.resources.FileDirContext" 
> docBase="c:/dev/proj1/web" />
>   <Resources 
> className="org.apache.naming.resources.FileDirContext" 
> docBase="c:/dev/proj2/web" />
> </Context>
> 
> If the directory c:/dev/proj1/web/ has a file called 
> index.html in it, I would expect loading the url 
> http://localhost:8080/myapp/index.html to return the file 
> c:/dev/proj1/web/index.html.  Am I reading this completely wrong?
> 
> This all seems to be a moot point anyway, since whenever I 
> make a <Resources> entry within a <Context> element, I get 
> the following error from Tomcat at startup:
> 
> java.lang.IllegalArgumentException: Document base 
> C:\usr\jakarta-tomcat-4.0.6\C:\test does not exist or is not 
> a readable directory
> 	at 
> org.apache.naming.resources.FileDirContext.setDocBase(FileDirC
> ontext.java:187)
> 	at 
> org.apache.catalina.core.StandardContext.setResources(Standard
> Context.java:1108)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
> 	at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
> 	at 
> org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
> 	at 
> org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
> 	at 
> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapt
> er.java:347)
> 	at 
> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
> 	at 
> org.apache.xerces.validators.common.XMLValidator.callEndElemen
> t(XMLValidator.java:1550)
> 	at 
> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XML
> DocumentScanner.java:1809)
> 	at 
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatch
> er.dispatch(XMLDocumentScanner.java:1182)
> 	at 
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDo
> cumentScanner.java:381)
> 	at 
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> 	at 
> org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:253)
> 	at 
> org.apache.catalina.util.xml.XmlMapper.readXml(XmlMapper.java:228)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:725)
> 	at 
> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
> 	at 
> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
> 	at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
> java.lang.NullPointerException
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:794)
> 	at 
> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
> 	at 
> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
> 	at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
> 
> --
> To unsubscribe, e-mail:   
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message