You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Blake McBride <bl...@gmail.com> on 2018/05/30 16:14:32 UTC

Deploying app twice when change ROOT

Hi,

I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.

I have several TLD's pointing to the same tomcat instance.  In
conf/server.xml I have the following _additional_ Host tag:

      <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
autoDeploy="false">
            <Context path="" docBase="myapp"/>
      </Host>

Under tomcat I have my app in the directory:  myappbase/myapp

I am able to access myapp via http://mydomain.com

This is as I desire.  The problem is that tomcat is deploying myapp twice!
Now I can access my app via:

 http://mydomain.com
      _and_
 http://mydomain.com/myapp

and, it's not just two ways of getting at the same app.  There is two
copies of the app running.

I know I can rename my app ROOT.  That works.  (I can access the app with
my other TLD and no suffix).  I don't want to do that because I have a
number of sites running a number of instances all of the same app.  Calling
them all ROOT is confusing.

Any help would sure be appreciated.

Blake McBride

Re: Deploying app twice when change ROOT

Posted by Mark Thomas <ma...@apache.org>.
On 30/05/18 18:37, Blake McBride wrote:
> IMO, tomcat should have code to allow my earlier configuration
> (without the deployOnStartup="false")
> and just detect that another app directory is the same as the declared root
> and not deploy it again.  This problem is all over the net and cost me
> hours.

Tomcat is doing exactly what you told it to do.

The Tomcat docs recommend against defining Contexts in server.xml.

Further, the automatic deployment docs state:
<quote>
Note that if you are defining contexts explicitly in server.xml, you
should probably turn off automatic application deployment or specify
deployIgnore carefully. Otherwise, the web applications will each be
deployed twice, and that may cause problems for the applications.
</quote>

Mark


> 
> Thanks!
> 
> Blake
> 
> 
> On Wed, May 30, 2018 at 12:30 PM, Blake McBride <bl...@gmail.com> wrote:
> 
>> Your suggestion is better.  Mine prevents other apps from that host from
>> deploying altogether.
>>
>>
>> On Wed, May 30, 2018 at 11:34 AM, Blake McBride <bl...@gmail.com>
>> wrote:
>>
>>> I think I may have found something that works.  I changes it to:
>>>
>>>       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
>>> autoDeploy="false" deployOnStartup="false">
>>>             <Context path="" docBase="myapp"/>
>>>       </Host>
>>>
>>> (I added the deployOnStartup="false")  Now tomcat is still deploying
>>> http://mydomain.com but it stopped deploying http://mydomain.com/myapp.
>>> This is just what I wanted.
>>>
>>> Thanks.
>>>
>>> Blake
>>>
>>>
>>>
>>> On Wed, May 30, 2018 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
>>>
>>>> On 30/05/18 17:14, Blake McBride wrote:
>>>>> Hi,
>>>>>
>>>>> I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.
>>>>>
>>>>> I have several TLD's pointing to the same tomcat instance.  In
>>>>> conf/server.xml I have the following _additional_ Host tag:
>>>>>
>>>>>       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
>>>>> autoDeploy="false">
>>>>>             <Context path="" docBase="myapp"/>
>>>>>       </Host>
>>>>>
>>>>> Under tomcat I have my app in the directory:  myappbase/myapp
>>>>>
>>>>> I am able to access myapp via http://mydomain.com
>>>>>
>>>>> This is as I desire.  The problem is that tomcat is deploying myapp
>>>> twice!
>>>>> Now I can access my app via:
>>>>>
>>>>>  http://mydomain.com
>>>>>       _and_
>>>>>  http://mydomain.com/myapp
>>>>>
>>>>> and, it's not just two ways of getting at the same app.  There is two
>>>>> copies of the app running.
>>>>>
>>>>> I know I can rename my app ROOT.  That works.  (I can access the app
>>>> with
>>>>> my other TLD and no suffix).  I don't want to do that because I have a
>>>>> number of sites running a number of instances all of the same app.
>>>> Calling
>>>>> them all ROOT is confusing.
>>>>>
>>>>> Any help would sure be appreciated.
>>>>
>>>> Name it ROOT##more-meaningful-name
>>>>
>>>> Mark
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>
> 


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


Re: Deploying app twice when change ROOT

Posted by Blake McBride <bl...@gmail.com>.
IMO, tomcat should have code to allow my earlier configuration
(without the deployOnStartup="false")
and just detect that another app directory is the same as the declared root
and not deploy it again.  This problem is all over the net and cost me
hours.

Thanks!

Blake


On Wed, May 30, 2018 at 12:30 PM, Blake McBride <bl...@gmail.com> wrote:

> Your suggestion is better.  Mine prevents other apps from that host from
> deploying altogether.
>
>
> On Wed, May 30, 2018 at 11:34 AM, Blake McBride <bl...@gmail.com>
> wrote:
>
>> I think I may have found something that works.  I changes it to:
>>
>>       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
>> autoDeploy="false" deployOnStartup="false">
>>             <Context path="" docBase="myapp"/>
>>       </Host>
>>
>> (I added the deployOnStartup="false")  Now tomcat is still deploying
>> http://mydomain.com but it stopped deploying http://mydomain.com/myapp.
>> This is just what I wanted.
>>
>> Thanks.
>>
>> Blake
>>
>>
>>
>> On Wed, May 30, 2018 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
>>
>>> On 30/05/18 17:14, Blake McBride wrote:
>>> > Hi,
>>> >
>>> > I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.
>>> >
>>> > I have several TLD's pointing to the same tomcat instance.  In
>>> > conf/server.xml I have the following _additional_ Host tag:
>>> >
>>> >       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
>>> > autoDeploy="false">
>>> >             <Context path="" docBase="myapp"/>
>>> >       </Host>
>>> >
>>> > Under tomcat I have my app in the directory:  myappbase/myapp
>>> >
>>> > I am able to access myapp via http://mydomain.com
>>> >
>>> > This is as I desire.  The problem is that tomcat is deploying myapp
>>> twice!
>>> > Now I can access my app via:
>>> >
>>> >  http://mydomain.com
>>> >       _and_
>>> >  http://mydomain.com/myapp
>>> >
>>> > and, it's not just two ways of getting at the same app.  There is two
>>> > copies of the app running.
>>> >
>>> > I know I can rename my app ROOT.  That works.  (I can access the app
>>> with
>>> > my other TLD and no suffix).  I don't want to do that because I have a
>>> > number of sites running a number of instances all of the same app.
>>> Calling
>>> > them all ROOT is confusing.
>>> >
>>> > Any help would sure be appreciated.
>>>
>>> Name it ROOT##more-meaningful-name
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>

Re: Deploying app twice when change ROOT

Posted by Blake McBride <bl...@gmail.com>.
Your suggestion is better.  Mine prevents other apps from that host from
deploying altogether.


On Wed, May 30, 2018 at 11:34 AM, Blake McBride <bl...@gmail.com> wrote:

> I think I may have found something that works.  I changes it to:
>
>       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
> autoDeploy="false" deployOnStartup="false">
>             <Context path="" docBase="myapp"/>
>       </Host>
>
> (I added the deployOnStartup="false")  Now tomcat is still deploying
> http://mydomain.com but it stopped deploying http://mydomain.com/myapp.
> This is just what I wanted.
>
> Thanks.
>
> Blake
>
>
>
> On Wed, May 30, 2018 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 30/05/18 17:14, Blake McBride wrote:
>> > Hi,
>> >
>> > I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.
>> >
>> > I have several TLD's pointing to the same tomcat instance.  In
>> > conf/server.xml I have the following _additional_ Host tag:
>> >
>> >       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
>> > autoDeploy="false">
>> >             <Context path="" docBase="myapp"/>
>> >       </Host>
>> >
>> > Under tomcat I have my app in the directory:  myappbase/myapp
>> >
>> > I am able to access myapp via http://mydomain.com
>> >
>> > This is as I desire.  The problem is that tomcat is deploying myapp
>> twice!
>> > Now I can access my app via:
>> >
>> >  http://mydomain.com
>> >       _and_
>> >  http://mydomain.com/myapp
>> >
>> > and, it's not just two ways of getting at the same app.  There is two
>> > copies of the app running.
>> >
>> > I know I can rename my app ROOT.  That works.  (I can access the app
>> with
>> > my other TLD and no suffix).  I don't want to do that because I have a
>> > number of sites running a number of instances all of the same app.
>> Calling
>> > them all ROOT is confusing.
>> >
>> > Any help would sure be appreciated.
>>
>> Name it ROOT##more-meaningful-name
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Deploying app twice when change ROOT

Posted by Blake McBride <bl...@gmail.com>.
I think I may have found something that works.  I changes it to:

      <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
autoDeploy="false" deployOnStartup="false">
            <Context path="" docBase="myapp"/>
      </Host>

(I added the deployOnStartup="false")  Now tomcat is still deploying
http://mydomain.com but it stopped deploying http://mydomain.com/myapp.
This is just what I wanted.

Thanks.

Blake



On Wed, May 30, 2018 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:

> On 30/05/18 17:14, Blake McBride wrote:
> > Hi,
> >
> > I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.
> >
> > I have several TLD's pointing to the same tomcat instance.  In
> > conf/server.xml I have the following _additional_ Host tag:
> >
> >       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
> > autoDeploy="false">
> >             <Context path="" docBase="myapp"/>
> >       </Host>
> >
> > Under tomcat I have my app in the directory:  myappbase/myapp
> >
> > I am able to access myapp via http://mydomain.com
> >
> > This is as I desire.  The problem is that tomcat is deploying myapp
> twice!
> > Now I can access my app via:
> >
> >  http://mydomain.com
> >       _and_
> >  http://mydomain.com/myapp
> >
> > and, it's not just two ways of getting at the same app.  There is two
> > copies of the app running.
> >
> > I know I can rename my app ROOT.  That works.  (I can access the app with
> > my other TLD and no suffix).  I don't want to do that because I have a
> > number of sites running a number of instances all of the same app.
> Calling
> > them all ROOT is confusing.
> >
> > Any help would sure be appreciated.
>
> Name it ROOT##more-meaningful-name
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Deploying app twice when change ROOT

Posted by Mark Thomas <ma...@apache.org>.
On 30/05/18 17:14, Blake McBride wrote:
> Hi,
> 
> I am using tomcat 8.5.31 on a 64 bit Linux box running JDK 1.8.0_162.
> 
> I have several TLD's pointing to the same tomcat instance.  In
> conf/server.xml I have the following _additional_ Host tag:
> 
>       <Host name="mydomain.com" appBase="myappbase" unpackWARs="false"
> autoDeploy="false">
>             <Context path="" docBase="myapp"/>
>       </Host>
> 
> Under tomcat I have my app in the directory:  myappbase/myapp
> 
> I am able to access myapp via http://mydomain.com
> 
> This is as I desire.  The problem is that tomcat is deploying myapp twice!
> Now I can access my app via:
> 
>  http://mydomain.com
>       _and_
>  http://mydomain.com/myapp
> 
> and, it's not just two ways of getting at the same app.  There is two
> copies of the app running.
> 
> I know I can rename my app ROOT.  That works.  (I can access the app with
> my other TLD and no suffix).  I don't want to do that because I have a
> number of sites running a number of instances all of the same app.  Calling
> them all ROOT is confusing.
> 
> Any help would sure be appreciated.

Name it ROOT##more-meaningful-name

Mark

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