>>Oh, because at this point your "docBase" needs to be changed to >>"foo.war".

Thanks Pier, That solved the problem. 

Maybe an example war file could be added to the distribution that reflects this,
or at least the documentation updated to show it. 

Should the examples directory be distributed as examples.war in the dist build?

#2:

Is it possible to make Tomcat to include the webapps directory when loading
servlets at startup? 

I added an entry to the web.xml file for my servlet to load at startup, but it
couldn't find my class: foo.class in my foo.jar file from the expanded war file
foo.war in my context /foo

In web.xml:

<servlet>
     <servlet-name>foo servlet</servlet-name>
     <servlet-class>foo</servlet-class>
     <load-on-startup>7</load-on-startup>
   </servlet>

In server.xml:

<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"> ...
</Host>

<Context path="/foo" docBase="foo.war" debug="0"
                reloadable="true">
                ...
</Context>

In /webapps/foo.war:

/webapps/frn/WEB-INF/lib/foo.jar which contains: foo.class

____________________Reply Separator____________________
Subject:    Re: 4.0b7 war/context Base Directory problem
Author: [EMAIL PROTECTED]
Date:       8/13/2001 4:06 PM

Jonathan Pierce at [EMAIL PROTECTED] wrote:
> 
> In 4.0b7, I can't get war files to expand at startup in time for a context in
> the server.xml directory to not complain.
> 
> I'm trying to put a war file in the webapps directory and define a context
> that
> references the expanded version of the war but Tomcat 4.0b7 complains at
> startup
> that the document base directory doesn't exist. The documentation implies that
> this should work and it worked fine in Tomcat 3.2.3.
> 
> What do I need to do to make this work in Tomcat 4.0b7?
> 
> My Host entry has unpackWARs = "true"
> 
> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
> ...
> </Host>
> 
> The war file is: /webapps/foo.war
> 
> The server.xml context entry is:
> 
> <Context path="/foo" docBase="foo" debug="0"
>                reloadable="true">
>                ...
>       </Context>
> 
> The error message I get at startup is:
> 
> java.lang.IllegalArgumentException: Document base ..\webapps\foo does not
> exist or is not a readable directory

Oh, because at this point your "docBase" needs to be changed to "foo.war".
It'll be later on expanded by Tomcat, and all will be handled correctly
(yeah, I know, the attribute name is kinda misleading)...

Or, at least, it works for me using "examples.war" :)

    Pier

Reply via email to