On Sat, Feb 26, 2011 at 6:29 AM, Matthew Woodward <[email protected]> wrote:
>
> I *believe* I got this worked out while I was at OpenCF Summit. I talked a
> bit with Jamie Krug about the issue and he confirmed the suspicions we were
> having, and I did a test setup where at least the work directories for every
> webapp were not being created under every other webapp, which was encouraging.
> I still need to test to make sure the scheduled task issue doesn't persist in
> this new setup, so I'll report back when I get a chance to do that.
Derrick and I tested a bit more and we think we have this licked.
Each webapp needs its own appBase, and (as per the Tomcat
documentation) the appBase's can't "overlap" meaning you can't have
one appBase inside another.
So if you still want to put all your webapps in the Tomcat webapps
directory, you'll need a directory for each app and then you'll need
to specify that directory as each host's appbase in your Tomcat
configuration.
Let's assume two apps in Tomcat called (imaginatively) app1 and app2.
You'd have this directory structure:
{tomcat_home}
webapps
app1
app1
app2
app2
Where the higher-level app1/2 directory is the appBase for app1/2, and
the one inside each of those is your docBase for each app.
Then in your server.xml (or if you're a good boy and do things the
recommended way, in your context.xml files):
<Host name="app1.local" appBase="/full/path/to/webapps/app1">
<Context path="" docBase="app1" />
</Host>
<Host name="app2.local" appBase="/full/path/to/webapps/app2">
<Context path="" docBase="app2" />
</Host>
Derrick and I experimented with a lot of different scenarios as far as
the appBase and docBase settings, and unfortunately (if I remember
correctly at this point) you *cannot* have the appBase be relative to
the default Tomcat appBase, which is kind of a bummer since that would
have made things more portable.
So in the example above, since I have my application directories under
webapps, you'd think I could specify an appBase of simply "app1" and
"app2" for my two apps since that's relative to Tomcat's default
appBase. That "works" in the sense that the apps run, but it causes
the same issue with the scheduled tasks running multiple times.
With the appBase set to a full path you can then set the docBase
relative to your appBase and all is well.
I'll probably write up a blog post on this to outline more clearly but
I'm cleaning up my inbox and wanted to share what we figured out.
I'm by no means a Tomcat expert so if any of this is off "base"
(pardon the pun) or if there's a better way to do any of this please
chime in.
Thanks.
--
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward
Please do not send me proprietary file formats such as Word,
PowerPoint, etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
--
official tag/function reference: http://openbd.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en