-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 12/9/16 11:40 AM, Victor Rodriguez wrote:
> Being able to have xyz as an alias for abc would be great, but
> everything I've tried with aliases hasn't worked either.
> 
> On Fri, Dec 9, 2016 at 8:28 AM, Victor Rodriguez
> <victropo...@gmail.com> wrote:
> 
>> Chris, I really don't want double deployment.  I'm trying to have
>> a single abc.war and avoid having to install apache to
>> redirect/rewrite http://host:8082/xyz to http://host:8082/abc.  I
>> was hoping there was a way to have tomcat send /xyz to abc.war.
>> I suppose I could also just copy abc.war to xyz.war and have both
>> in the webapps directory, but I'm trying to avoid that.
>> 
>> On Fri, Dec 9, 2016 at 8:23 AM, Christopher Schultz < 
>> ch...@christopherschultz.net> wrote:
>> 
> Victor,
> 
> On 12/9/16 11:17 AM, Victor Rodriguez wrote:
>>>>> Chris, a little more progress this morning...
>>>>> 
>>>>> This is what I currently have in my xyz.xml
>>>>> 
>>>>> <Context override="true" swallowOutput="true" 
>>>>> docBase="wfsservice.war">
>>>>> 
>>>>> And, this is what I get in my catalina.out...
>>>>> 
>>>>> INFO: Deploying configuration descriptor 
>>>>> /dg/local/cots/tomcat/tomcat_8082/conf/Catalina/localhost/xyz.xml
>>>>>
>>>>>
>>>>> 
...then...
>>>>> 
>>>>> WARNING: A docBase 
>>>>> /dg/local/cots/tomcat/tomcat_8082/webapps/abc.war inside
>>>>> the host appBase has been specified, and will be ignored
> 
> Aah, yes. This is probably because specifying a docBase inside the 
> appBase usually indicates a mistake that will result in 
> double-deployment of a web application. But double-deployment is 
> precicely what you are requesting.
> 
> We'll need to do this then:
> 
> 1. Put abc.war somewhere else 2. Change the path in xyz.xml to
> match #1 3. Copy xyz.xml to abc.xml in the same directory 4.
> Profit
> 
>>>>> ...then...
>>>>> 
>>>>> SEVERE: Error starting static Resources
>>>>> 
>>>>> java.lang.IllegalArgumentException: Document base 
>>>>> /dg/local/cots/tomcat/tomcat_8082/webapps/xyz does not
>>>>> exist or is not a readable directory
>>>>> 
>>>>> So, it looks like it's looking for an exploded xyz
>>>>> directory.
> 
> It might be. But there isn't a stack trace so I have no idea if
> that is even being produced by Tomcat.
> 
> -chris
> 
>>>>> On Fri, Dec 9, 2016 at 8:07 AM, Christopher Schultz < 
>>>>> ch...@christopherschultz.net> wrote:
>>>>> 
>>>>> Victor,
>>>>> 
>>>>> On 12/8/16 7:57 PM, Victor Rodriguez wrote:
>>>>>>>> On Thu, Dec 8, 2016 at 2:50 PM, Christopher Schultz
>>>>>>>> < ch...@christopherschultz.net> wrote:
>>>>>>>> 
>>>>>>>>> Victor,
>>>>>>>>> 
>>>>>>>>> On 12/8/16 4:59 PM, Victor Rodriguez wrote:
>>>>>>>>>>>> THANKS IN ADVANCE FOR YOUR HELP!  (not
>>>>>>>>>>>> yelling, just emphasizing!)
>>>>>>>>>>>> 
>>>>>>>>>>>> I have abc.war and I want both /abc and /xyz
>>>>>>>>>>>> to work for it.  I've tried adding 
>>>>>>>>>>>> aliases="/abc=abc.war,/xyz=abc.war" and 
>>>>>>>>>>>> aliases="/abc=abc,/xyz=abc" but neither of
>>>>>>>>>>>> those worked.  This is how my original
>>>>>>>>>>>> context.xml looked like.
>>>>>>>>>>>> 
>>>>>>>>>>>> <Context override="true"
>>>>>>>>>>>> swallowOutput="true"> <!-- Doing
>>>>>>>>>>>> swallowOutput=true to allow each web 
>>>>>>>>>>>> applications System.out and System.err calls
>>>>>>>>>>>> to end up in a separate log, not in
>>>>>>>>>>>> catalina.out. See Jira CA-4589 --> <!--
>>>>>>>>>>>> Default set of monitored resources --> 
>>>>>>>>>>>> <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>>>>>>>>>>
>>>>>>>>>>>> 
<!-- Disable session persistence across Tomcat
>>>>>>>>>>>> restarts by including this line; no sessions
>>>>>>>>>>>> used for many OGC implemenations--> <Manager
>>>>>>>>>>>> pathname="" />
>>>>>>>>>>>> 
>>>>>>>>>>>> <!-- Uncomment this to enable Comet
>>>>>>>>>>>> connection tacking (provides events on
>>>>>>>>>>>> session expiration as well as webapp
>>>>>>>>>>>> lifecycle) --> <!-- <Valve 
>>>>>>>>>>>> className="org.apache.catalina.valves.CometConnectionManage
rVal
>
>>>>>>>>>>>> 
ve"
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>> 
>>>>>>>>>>>> 
> /> -->
>>>>>>>>>>>> 
>>>>>>>>>>>> </Context>
>>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Tomcat 7 aliases are intended to map URLs within a
>>>>>>>>> single web application. You can't use it to
>>>>>>>>> duplicate the web application on two base paths.
>>>>>>>>> 
>>>>>>>>> Here's what you need to do:
>>>>>>>>> 
>>>>>>>>> 1. Put your WAR file in webapps/abc.war. This will
>>>>>>>>> deploy as usual.
>>>>>>>>> 
>>>>>>>>> 2. Copy webapps/abc.war/META-INF/context.xml into 
>>>>>>>>> conf/Catalina/localhost/xyz.xml and modify the
>>>>>>>>> <Context> element like this:
>>>>>>>>> 
>>>>>>>>> <Context override="true" swallowOutput="true" 
>>>>>>>>> docBase="webapps/abc.war "> ... </Context>
>>>>>>>> 
>>>>>>>> Thanks Chris!  I now get "Document base 
>>>>>>>> /dg/local/cots/tomcat/tomcat_8082/webapps/xyz does
>>>>>>>> not exist or is not a readable directory"
>>>>> 
>>>>> Is that path correct? What is the stack trace of that
>>>>> error?
>>>>> 
>>>>> I would have expected the path to be pointing to abc.war,
>>>>> not .../xyz
>>>>> 
>>>>> -chris

You will have to use re-writing to do this, and you'll have to use a
REDIRECT. You can't simply alias one web application for another. You
can double-deploy, but there really isn't any other good way to do this.

What's your use-case, here, anyway?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYSu7TAAoJEBzwKT+lPKRYOjYP/3VUKDP1gZ7Vrijkl+WAOM6N
IHW/2h8WdtpO4MCeXe0E0SoFI5GTGFOjFLoRiyBMTzXcS0RebWdD7ociqOflEn/z
GWKAgLbZXPvkXB29Y4xt8n030g8GQMAZYreb9YixKNXcVGk5cdaOXvlfArFSzrct
UBEjCXqvEjio9MT91W0GC4WkTpwkKyKLLstoDSAKfZ97SiAsPaVbzRh+Epjfbc7r
M05PJp05mgPSuEwyndRw4a9sZ2BsETH/f5TOs5lLOl0tJcoXZk7nV9r7FK5yCrWZ
t3lhu/5MobyeDLwPlcy7qHV+bpr5QFfHRYfdMjtQ8ujyWZpv/2kJEejVQnOtXvXT
BSv7Tb+OmxjxYxpGioK5JesUhJp5JFkPL2H4qaiy4bIXqTtj2z2yWQsht71F4vBx
z4/5NXi3qLUSh3U1PIGBguN7qzbkG8F+hmFeCW+iJ3w+s6yzQMx5M3KHY29E1wpQ
A+A0/pUMa45nzxUhmCaOAVDuxVi8ffMiM0X1sERCo7U+l7o6kgK+zxwkEPzJ+ofy
gdM1oR5O/o3w8wuVWmXzhnDMCHO5HCKTK2dIkKi8lBWQUlf7BrrCuCZiDJaF//Ry
O2BXD98CC/dr5JiiR1Ox2qNXe1IwSSDJds6GO3rkGN43IjnFEdlJLkLhn66sF+5z
DxksGXkejqqERpinlC/E
=UH73
-----END PGP SIGNATURE-----

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

Reply via email to