appBase != docBase


Right now your Context is using the same value for its docBase as your Host is using for its appBase. Your docBase cannot be your appBase, not to mention that your Context is using a path of "/webapps" which could cause all sorts of weird problems.

Set appBase = /home/www/vhostxx/html/webapps but then set docBase = "myApp" or something like that (it is automatically relative to the appBase).

Then your Context would look something like this:

<Context path="" docBase="myApp">

Then the URL would be:

http://www.www.domain_vhostxx.at:8080/file.jsp

So you want:

appBase: /home/www/vhostxx/html/webapps
docBase: /home/www/vhostxx/html/webapps/myApp
JSP: /home/www/vhostxx/html/webapps/myApp/my.jsp
WEB-INF: /home/www/vhostxx/html/webapps/myApp/WEB-INF

John

Robert Zöhrer @ pronet.at wrote:

Hi all,

I've great problems with Tomcat and setting up a context in a 2nd
(virtual) host:

my environmemt:

OS: Redhat Linux
Platform: Intel x86

TC version: 4.1

tomcat4.conf:
--- cut -----
CATALINA_HOME="/var/tomcat4"
JASPER_HOME="/var/tomcat4"
CATALINA_TMPDIR="/var/tomcat4/temp"
---- cut -----

1) There is a dir called /home/www/vhostxx/html/webapps for the
vhost-files. There User uploaded her Apps via FTP. There are just a
few jsp-files and a WEB-INF-subdir with a standard web.xml.

Permissions:

drwxrwxrwx 2 vhostxx_user ftponly 4096 Aug 12 14:03 webapps

2) Host and Context are defined in server.xml (see below)

But when i define the Context (shown below) with den Admin Panel, I
get this error from the Logger:

2003-08-15 14:27:21 StandardContext[/webapps]: Resources start failed:
java.lang.IllegalArgumentException: Document base
/home/www/vhostxx/html/webapps does not exist or is not a
readable directory

and

2003-08-15 14:27:21 StandardContext[/webapps]: Context startup failed
due to previous errors
2003-08-15 14:27:21 StandardContext[/webapps]: Exception during
cleanup after start failed

:(

3) When I try http://www.www.domain_vhostxx.at:8080/webapps/file.jsp

I also get

HTTP Status 404 - /webapps/file.jsp
type Status report
message /webapps/file.jsp
description The requested resource (/webapps/file.jsp) is not available.

Of course, this is, because "Context startup failed" .. but why is
this so? TC has also add a work-dir for this host and context but the
context-working-dir is empty :(

There are no basicly problems, because the Admin Panel (localhost,
context: /admin) works fine.

Is it a problem, when appBase, docBase are outside $CATALINA_HOME?

Are there spezial permission needs for the appBase, docBase dirs? But
now there are permissions to ALL with

drwxrwxrwx 2 vhostxx_user ftponly 4096 Aug 12 14:03 webapps

Is there anything that I don't know?

I'ld be very very glad if anybody has an idea, because I've studied
the docs for days and can't see a mistake in my config?

Thanks a lot Robert


From server.xml:

############# Standard Localhost with Admin & Manager Context #######


<Host className="org.apache.catalina.core.StandardHost"
appBase="webapps" autoDeploy="true"
configClass="org.apache.catalina.startup.ContextConfig"
contextClass="org.apache.catalina.core.StandardContext" debug="0"
deployXML="true"
errorReportValveClass="org.apache.catalina.valves.ErrorReportValve"
liveDeploy="true"
mapperClass="org.apache.catalina.core.StandardHostMapper"
name="localhost" unpackWARs="true">
        <Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true" crossContext="false" debug="0" displayName="Tomcat
Administration Application" docBase="../server/webapps/admin"
mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/admin" privileged="true" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
          <Logger className="org.apache.catalina.logger.FileLogger"
debug="0" directory="logs" prefix="localhost_admin_log." suffix=".txt"
timestamp="true" verbosity="1"/>
        </Context>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true" crossContext="false" debug="0" displayName="Tomcat
Manager Application" docBase="../server/webapps/manager"
mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/manager" privileged="true" reloadable="false"
swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
          <ResourceLink global="UserDatabase" name="users"
type="org.apache.catalina.UserDatabase"/>
        </Context>
</Host>

############# my new Host ###########################

<Host className="org.apache.catalina.core.StandardHost"
appBase="/home/www/vhostxx/html/webapps" autoDeploy="true"
configClass="org.apache.catalina.startup.ContextConfig"
contextClass="org.apache.catalina.core.StandardContext" debug="0"
deployXML="true"
errorReportValveClass="org.apache.catalina.valves.ErrorReportValve"
liveDeploy="true"
mapperClass="org.apache.catalina.core.StandardHostMapper"
name="www.domain_vhostxx.at" unpackWARs="true">
      <Alias>domain_vhostxx.at</Alias>

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true" crossContext="true" debug="0"
docBase="/home/www/vhostxx/html/webapps"
mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/webapps" privileged="false" reloadable="true"
swallowOutput="true" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
        </Context>
      </Host>




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to