You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob DeRemer <bo...@thingworx.com> on 2011/08/01 20:49:49 UTC

HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

I'm running Tomcat 6.0.32 on Windows Server 2008 R2.

I am running into a problem when managing our webapp via the Tomcat Manager App.  Specifically, if I add any files to our WEB-INF/extension directory in the exploded WAR directory after the initial deployment, an undeploy fails to completely remove our exploded webapp directory.  It removes everything that was in the WAR, but leaves the manually added files.  In addition, if we attempt to deploy a new WAR when this skeleton directory is left, the deploy says it's successful, but doesn't explode the new WAR.

If anyone has any suggestions on how we can add files into the exploded webapp structure and still perform undeploy/re-deploy of our webapp, I would greatly appreciate it.  Or, if there's a way to tell tomcat to completely remove the directory - regardless of additional files/directories, that would probably work, too.

The only other options I can think of would be installing these dynamic extensions outside the webapp, but that's not ideal since some of these extensions will be HTML/CSS content and we'd like to keep it all under the webapp root.

Thanks,

Bob DeRemer
Senior Director, Architecture and Development

http://www.thingworx.com<http://www.thingworx.com/>
Skype: bob.deremer
O: 717.505.7923
M: 717.881.3986


Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Chema <de...@gmail.com>.
2011/8/1 Bob DeRemer <bo...@thingworx.com>:
> Thanks, but I need to do this in a production environment, where we're deploying/re-deploying a WAR and there is no eclipse IDE.  In addition, I am dynamically adding extensions to our webapp without having to restart our webapp, which is what republishing from Eclipse does.

OK.
I'm not expert and I cannot speak so much about this tool, but you
could have a look at LiveRebel

http://www.zeroturnaround.com/liverebel/

But it's not for free

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


RE: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Bob DeRemer <bo...@thingworx.com>.
Also - I just looked at my local tomcat 6.0.32 server.xml and it has JreMemoryLeakPreventionListener on the Server element.  The implicit disabling of URL caching this is supposed to do must not have an effect on this scenario.

As an aside, when I used antiJARLocking + antiResourceLocking on the server's context.xml, it appeared to work, but that has other documented side effects - such as creating a bunch of garbage in the tomcat/temp directory.   As a result, this really isn't a solution for us.

Any suggestions on how we can get these JAR(s) not to be locked - without using the context attributes?

Thanks,
bob

-----Original Message-----
From: Bob DeRemer [mailto:bob.deremer@thingworx.com] 
Sent: Monday, August 01, 2011 9:12 PM
To: Tomcat Users List
Subject: RE: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Hi Mark,

Actually, in the logs it does tell me that ExpandWar deleteDir failed.  This is because my "extensions" I have are actually JAR files that we're dynamically loaded so we don't have to restart the webapp.  I'm using the addUrl hack, but by casting the main webapp's Thread.currentThread().getContextClassLoader() to a URLClassLoader.  From a dynamic loading standpoint, it works great!  It allows extension classes in an extension JAR to derive from classes in our built-in product JAR(s) loaded by the same [I'm assuming] webapp classloader. 

The problem is, when I shutdown/undeploy the webapp, everything else gets deleted, but not the JAR(s) that are dynamically loaded.  Tomcat should not be holding on to these because I am NOT using the System class loader to load them.  Problem is, I'm not sure why these are not being unloaded.

Is there any way to force tomcat to release these?  I tried putting the antiJARLocking="true" in the main Context.xml as well as a local context.xml in META-INF and neither of these worked.

Thanks in advance,
Bob

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: Monday, August 01, 2011 3:44 PM
To: Tomcat Users List
Subject: Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

On 01/08/2011 20:32, Bob DeRemer wrote:
> Thanks, but I need to do this in a production environment, where we're 
> deploying/re-deploying a WAR and there is no eclipse IDE.  In 
> addition, I am dynamically adding extensions to our webapp without 
> having to restart our webapp, which is what republishing from Eclipse 
> does.

Any messages in the logs? Tomcat 7 will report if it can't delete a file. I don't recall if Tomcat 6 does.

If a file is under the docBase and is not deleted it is because something (probably your app) still has the file open. You need to close the files before you redeploy.

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


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


Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Mark Thomas <ma...@apache.org>.
On 02/08/2011 09:54, Bob DeRemer wrote:
> Should YourKit be able to pinpoint this?  I've used it for memory and
> other profiling, but haven't used it to see what might be holding
> onto JARs after a webapp has been shutdown.

It should do. I have used it in the past to track down locked files.

Mark

> 
> Thanks again, Bob
> 
> -----Original Message----- From: Mark Thomas
> [mailto:markt@apache.org] Sent: Tuesday, August 02, 2011 3:52 AM To:
> Tomcat Users List Subject: Re: HOW TO: re-deploy or undeploy a webapp
> when additional files are added after initial deployment
> 
> On 02/08/2011 02:11, Bob DeRemer wrote:
>> Hi Mark,
>> 
>> Actually, in the logs it does tell me that ExpandWar deleteDir
>> failed. This is because my "extensions" I have are actually JAR
>> files that we're dynamically loaded so we don't have to restart the
>> webapp.  I'm using the addUrl hack, but by casting the main
>> webapp's Thread.currentThread().getContextClassLoader() to a
>> URLClassLoader. From a dynamic loading standpoint, it works great!
>> It allows extension classes in an extension JAR to derive from
>> classes in our built-in product JAR(s) loaded by the same [I'm
>> assuming] webapp classloader.
>> 
>> The problem is, when I shutdown/undeploy the webapp, everything
>> else gets deleted, but not the JAR(s) that are dynamically loaded.
>> Tomcat should not be holding on to these because I am NOT using the
>> System class loader to load them.  Problem is, I'm not sure why
>> these are not being unloaded.
> 
> You'll need to get a profiler to see what is holding on to references
> to those JARs.
> 
>> Is there any way to force tomcat to release these?  I tried putting
>>  the antiJARLocking="true" in the main Context.xml as well as a
>> local context.xml in META-INF and neither of these worked.
> 
> Without knowing what is holding on to the reference, it is pretty
> much impossible to determine the best way to solve this problem.
> 
> Mark
> 
>> 
>> Thanks in advance, Bob
>> 
>> -----Original Message----- From: Mark Thomas
>> [mailto:markt@apache.org] Sent: Monday, August 01, 2011 3:44 PM
>> To: Tomcat Users List Subject: Re: HOW TO: re-deploy or undeploy a
>> webapp when additional files are added after initial deployment
>> 
>> On 01/08/2011 20:32, Bob DeRemer wrote:
>>> Thanks, but I need to do this in a production environment, where
>>>  we're deploying/re-deploying a WAR and there is no eclipse IDE.
>>> In addition, I am dynamically adding extensions to our webapp
>>> without having to restart our webapp, which is what republishing
>>> from Eclipse does.
>> 
>> Any messages in the logs? Tomcat 7 will report if it can't delete a
>>  file. I don't recall if Tomcat 6 does.
>> 
>> If a file is under the docBase and is not deleted it is because 
>> something (probably your app) still has the file open. You need to
>>  close the files before you redeploy.
>> 
>> 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
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
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
> 


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


RE: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Bob DeRemer <bo...@thingworx.com>.
Should YourKit be able to pinpoint this?  I've used it for memory and other profiling, but haven't used it to see what might be holding onto JARs after a webapp has been shutdown.

Thanks again,
Bob

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Tuesday, August 02, 2011 3:52 AM
To: Tomcat Users List
Subject: Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

On 02/08/2011 02:11, Bob DeRemer wrote:
> Hi Mark,
> 
> Actually, in the logs it does tell me that ExpandWar deleteDir failed.  
> This is because my "extensions" I have are actually JAR files that 
> we're dynamically loaded so we don't have to restart the webapp.  I'm 
> using the addUrl hack, but by casting the main webapp's
> Thread.currentThread().getContextClassLoader() to a URLClassLoader.
> From a dynamic loading standpoint, it works great!  It allows 
> extension classes in an extension JAR to derive from classes in our 
> built-in product JAR(s) loaded by the same [I'm assuming] webapp 
> classloader.
> 
> The problem is, when I shutdown/undeploy the webapp, everything else 
> gets deleted, but not the JAR(s) that are dynamically loaded.  Tomcat 
> should not be holding on to these because I am NOT using the System 
> class loader to load them.  Problem is, I'm not sure why these are not 
> being unloaded.

You'll need to get a profiler to see what is holding on to references to those JARs.

> Is there any way to force tomcat to release these?  I tried putting 
> the antiJARLocking="true" in the main Context.xml as well as a local 
> context.xml in META-INF and neither of these worked.

Without knowing what is holding on to the reference, it is pretty much impossible to determine the best way to solve this problem.

Mark

> 
> Thanks in advance, Bob
> 
> -----Original Message----- From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Monday, August 01, 2011 3:44 PM To:
> Tomcat Users List Subject: Re: HOW TO: re-deploy or undeploy a webapp 
> when additional files are added after initial deployment
> 
> On 01/08/2011 20:32, Bob DeRemer wrote:
>> Thanks, but I need to do this in a production environment, where 
>> we're deploying/re-deploying a WAR and there is no eclipse IDE.  In  
>> addition, I am dynamically adding extensions to our webapp without  
>> having to restart our webapp, which is what republishing from Eclipse 
>> does.
> 
> Any messages in the logs? Tomcat 7 will report if it can't delete a 
> file. I don't recall if Tomcat 6 does.
> 
> If a file is under the docBase and is not deleted it is because 
> something (probably your app) still has the file open. You need to 
> close the files before you redeploy.
> 
> 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
> 


---------------------------------------------------------------------
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: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Mark Thomas <ma...@apache.org>.
On 02/08/2011 02:11, Bob DeRemer wrote:
> Hi Mark,
> 
> Actually, in the logs it does tell me that ExpandWar deleteDir
> failed.  This is because my "extensions" I have are actually JAR
> files that we're dynamically loaded so we don't have to restart the
> webapp.  I'm using the addUrl hack, but by casting the main webapp's
> Thread.currentThread().getContextClassLoader() to a URLClassLoader.
> From a dynamic loading standpoint, it works great!  It allows
> extension classes in an extension JAR to derive from classes in our
> built-in product JAR(s) loaded by the same [I'm assuming] webapp
> classloader.
> 
> The problem is, when I shutdown/undeploy the webapp, everything else
> gets deleted, but not the JAR(s) that are dynamically loaded.  Tomcat
> should not be holding on to these because I am NOT using the System
> class loader to load them.  Problem is, I'm not sure why these are
> not being unloaded.

You'll need to get a profiler to see what is holding on to references to
those JARs.

> Is there any way to force tomcat to release these?  I tried putting
> the antiJARLocking="true" in the main Context.xml as well as a local
> context.xml in META-INF and neither of these worked.

Without knowing what is holding on to the reference, it is pretty much
impossible to determine the best way to solve this problem.

Mark

> 
> Thanks in advance, Bob
> 
> -----Original Message----- From: Mark Thomas
> [mailto:markt@apache.org] Sent: Monday, August 01, 2011 3:44 PM To:
> Tomcat Users List Subject: Re: HOW TO: re-deploy or undeploy a webapp
> when additional files are added after initial deployment
> 
> On 01/08/2011 20:32, Bob DeRemer wrote:
>> Thanks, but I need to do this in a production environment, where
>> we're deploying/re-deploying a WAR and there is no eclipse IDE.  In
>>  addition, I am dynamically adding extensions to our webapp without
>>  having to restart our webapp, which is what republishing from
>> Eclipse does.
> 
> Any messages in the logs? Tomcat 7 will report if it can't delete a
> file. I don't recall if Tomcat 6 does.
> 
> If a file is under the docBase and is not deleted it is because
> something (probably your app) still has the file open. You need to
> close the files before you redeploy.
> 
> 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
> 


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


RE: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Bob DeRemer <bo...@thingworx.com>.
Hi Mark,

Actually, in the logs it does tell me that ExpandWar deleteDir failed.  This is because my "extensions" I have are actually JAR files that we're dynamically loaded so we don't have to restart the webapp.  I'm using the addUrl hack, but by casting the main webapp's Thread.currentThread().getContextClassLoader() to a URLClassLoader.  From a dynamic loading standpoint, it works great!  It allows extension classes in an extension JAR to derive from classes in our built-in product JAR(s) loaded by the same [I'm assuming] webapp classloader. 

The problem is, when I shutdown/undeploy the webapp, everything else gets deleted, but not the JAR(s) that are dynamically loaded.  Tomcat should not be holding on to these because I am NOT using the System class loader to load them.  Problem is, I'm not sure why these are not being unloaded.

Is there any way to force tomcat to release these?  I tried putting the antiJARLocking="true" in the main Context.xml as well as a local context.xml in META-INF and neither of these worked.

Thanks in advance,
Bob

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Monday, August 01, 2011 3:44 PM
To: Tomcat Users List
Subject: Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

On 01/08/2011 20:32, Bob DeRemer wrote:
> Thanks, but I need to do this in a production environment, where we're 
> deploying/re-deploying a WAR and there is no eclipse IDE.  In 
> addition, I am dynamically adding extensions to our webapp without 
> having to restart our webapp, which is what republishing from Eclipse 
> does.

Any messages in the logs? Tomcat 7 will report if it can't delete a file. I don't recall if Tomcat 6 does.

If a file is under the docBase and is not deleted it is because something (probably your app) still has the file open. You need to close the files before you redeploy.

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: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Mark Thomas <ma...@apache.org>.
On 01/08/2011 20:32, Bob DeRemer wrote:
> Thanks, but I need to do this in a production environment, where 
> we're deploying/re-deploying a WAR and there is no eclipse IDE.  In 
> addition, I am dynamically adding extensions to our webapp without 
> having to restart our webapp, which is what republishing from
> Eclipse does.

Any messages in the logs? Tomcat 7 will report if it can't delete a
file. I don't recall if Tomcat 6 does.

If a file is under the docBase and is not deleted it is because
something (probably your app) still has the file open. You need to close
the files before you redeploy.

Mark

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


RE: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Bob DeRemer <bo...@thingworx.com>.
Thanks, but I need to do this in a production environment, where we're deploying/re-deploying a WAR and there is no eclipse IDE.  In addition, I am dynamically adding extensions to our webapp without having to restart our webapp, which is what republishing from Eclipse does.

-bob

-----Original Message-----
From: Chema [mailto:demablogia@gmail.com] 
Sent: Monday, August 01, 2011 3:02 PM
To: Tomcat Users List
Subject: Re: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

> If anyone has any suggestions on how we can add files into the exploded webapp structure and still perform undeploy/re-deploy of our webapp, I would greatly appreciate it.  Or, if there's a way to tell tomcat to completely remove the directory - regardless of additional files/directories, that would probably work, too.
>

Eclipse Hellios' plugins to deploy web applications work fine for me.
You can try Eclipse IDE for Java EE Developers.

When I change any file deployed , it's automatically republished. And you can clean work folders from IDE.

---------------------------------------------------------------------
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: HOW TO: re-deploy or undeploy a webapp when additional files are added after initial deployment

Posted by Chema <de...@gmail.com>.
> If anyone has any suggestions on how we can add files into the exploded webapp structure and still perform undeploy/re-deploy of our webapp, I would greatly appreciate it.  Or, if there's a way to tell tomcat to completely remove the directory - regardless of additional files/directories, that would probably work, too.
>

Eclipse Hellios' plugins to deploy web applications work fine for me.
You can try Eclipse IDE for Java EE Developers.

When I change any file deployed , it's automatically republished. And
you can clean work folders from IDE.

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