Jerry,

On 1/30/2014 6:39 PM, Jerry Malcolm wrote:
Thanks so much for the info and ongoing education.  I think I'm
getting there.  But please bear with me.  I'm still trying to get a
handle on how this all works and what the best practices are.


It's really not what the best practices are, it's what is documented.

I now understand that TC will take all folders it finds in the appBase
folder and deploy them, assuming they are all webapps.  I'm assuming
from what you said that the default path for each webapp is the folder
name in appBase.  I realize that this is super easy as long as you
don't have any unique things to specify about the deployment such as a
database resource.

So assuming I need to specify more info about a particular webapp
deployment, I can define a context file that augments the deployment
info for a particular auto-deployed app in appBase.  But from what you
said previously regarding the error I was getting, if the webapp is in
appBase, I have no choice but to use the appBase's folder name as the
context path.  Am I correct so far?


Read the following:

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

It goes into great detail concerning how paths are determined.

In short, correct.

But if I put the webapp anywhere outside of the appBase folder, I can
now create a context file for the app using any desired context path
as the name of the context file and point to the webapp, no matter
what the name or location using docBase, correct?


Yes

If my understanding is correct, then fine.  I'm one step closer...  It
does seem strange that I can't alias the context path to get to an
appBase webapp using a desired URL.

This is not Apache HTTPD. Do not think of the directories as you would there (Location, Directory, Alias). It's not applicable here.

But I'm sure there are reasons,
and if that's the way it is, fine.  I just need to understand the
rules.  But all of this did work with path aliasing in 7.0.27 when I
just had all of the context tags directly in server.xml.

I suspect that there were lots of error messages, and potentially double deployment. So, while your content may have been served from Tomcat, working is a relative term.

So that's
why I'm struggling with the changes to the rules and capabilities.


These rules have been in place since at least Tomcat 6.

So.... the simple answer as far as doing things correctly in TC is to
rename all of my webapps in the appBase folder to match their
associated context paths.  I will likely head that direction.  But I
have a pretty complex automated build process that I will need to go
into and modify things to get this implemented.  Unfortunately, that
can't happen overnight.

In the meantime, I've got lots of webapps from my earlier, currently
working config that use a context path that is different from the
appBase folder name.

You mean docBase (I think).

docBase - the document base for an individual application
appBase - where all of a particular Host's applications live

Again, see the following:

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

I think I know what I can do.  But I want to see
if it violates the rules and how bad.....

My proposal is to keep the appBase pointing to the webapps folder.
And any webapps that have matching paths and names can go there and
work fine.

Next, until I can change the build process to create the webapps named
as the context path, can I create a parallel "webapps2" folder and NOT
point appBase to it and put all of the 'misnamed' webapps in there?

You would not mention this directory anywhere in server.xml.

Then go to the context files for those webapps and fully qualify the
docBase (c:\domains\myHost\webapps2\myWebApp1)?

Yes.


I realize this is not the recommended design.  But I need a stopgap
solution until I can change the build process.  So, is this solution
at least an "acceptable" one in the interim?

Lots of people do this. One of the advantages of doing it this way is that Tomcat upgrades are easier. You can just do the following:

1. Install a new Tomcat
2. Add the virtual Host elements into the new server.xml
3. Copy over the old conf\Catalina\[hostname]\appName.xml files
4. Shut down the old Tomcat
5. Start the new Tomcat

If not, what is the best
way for me to keep my misnamed webapps that don't match the context
path for a while and still keep the lights on?

Thanks.

Jerry

/mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to