Tomcat deploys application multiple times

L

luke.borloz

We have a Tomcat 5.5.23 installation that we have set to unpack and
auto deploy WARs. It seems that when I SCP the WAR file into the
webapps directory on the server, Tomcat is trying to redeploy the app
multiple times while it's copying. I'm running an ANT script to
compile, WAR and SCP. The whole process takes about 50 seconds. Is
there a way to set a delay on the auto-deploy from the time Tomcat
sees the new WAR in the directory until it actually tries to deploy
it, or is there some other way to keep Tomcat from trying to deploy
before the whole file reaches the server?
 
S

Sanjay

We have a Tomcat 5.5.23 installation that we have set to unpack and
auto deploy WARs. It seems that when I SCP the WAR file into the
webapps directory on the server, Tomcat is trying to redeploy the app
multiple times while it's copying. I'm running an ANT script to
compile, WAR and SCP. The whole process takes about 50 seconds. Is
there a way to set a delay on the auto-deploy from the time Tomcat
sees the new WAR in the directory until it actually tries to deploy
it, or is there some other way to keep Tomcat from trying to deploy
before the whole file reaches the server?
Why can't you stop the server, deploy and start it up or copy the file
to a temp location and copy to deploy directory only after entire file
is copied via scp?
 
L

luke.borloz

Why can't you stop the server, deploy and start it up or copy the file
to a temp location and copy to deploy directory only after entire file
is copied via scp?

I could do that, but the point of doing everything in the ANT script
is to make it easy. Having to stop the server or copy from one
location to another would no longer be as easy. The real problem is
that we are using Hibernate and from what I understand it is prone to
memory leaks. So, each time we redeploy an application, it eats up
more memory and causes java.lang.OutOfMemoryError: PermGen space
errors. If we could somehow fix Hibernate, (in theory) it wouldn't
matter how many times the app deployed.
 
M

Manish Pandit

I could do that, but the point of doing everything in the ANT script
is to make it easy. Having to stop the server or copy from one
location to another would no longer be as easy. The real problem is
that we are using Hibernate and from what I understand it is prone to
memory leaks. So, each time we redeploy an application, it eats up
more memory and causes java.lang.OutOfMemoryError: PermGen space
errors. If we could somehow fix Hibernate, (in theory) it wouldn't
matter how many times the app deployed.

If you put anything with *.war in $TOMCAT_HOME/webapps, tomcat will
pick it up as a part of its hotdeploy monitor regardless of the
integrity. I'd recommend scp-ing it as another extension (like .myapp)
and then once its copied completely, rename it to .war. This will
ensure tomcat never picks up a partial file, and this is doable via
ant as you pointed out.

-cheers,
Manish
 
M

Mark Jeffcoat

We have a Tomcat 5.5.23 installation that we have set to unpack and
auto deploy WARs. It seems that when I SCP the WAR file into the
webapps directory on the server, Tomcat is trying to redeploy the app
multiple times while it's copying. I'm running an ANT script to
compile, WAR and SCP. The whole process takes about 50 seconds. Is
there a way to set a delay on the auto-deploy from the time Tomcat
sees the new WAR in the directory until it actually tries to deploy
it, or is there some other way to keep Tomcat from trying to deploy
before the whole file reaches the server?

This isn't an answer to the question you asked, but
have you seen the Tomcat Manager ant tasks at
http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html
?

I use the deploy task to manage everything, but if you
need to keep the "secure" in your secure copy, you could
use the start and stop tasks to prevent Tomcat from trying
to unpack the war until the SCP finishes.
 
C

christopher

We have a Tomcat 5.5.23 installation that we have set to unpack and
auto deploy WARs. It seems that when I SCP the WAR file into the
webapps directory on the server, Tomcat is trying to redeploy the app
multiple times while it's copying. I'm running an ANT script to
compile, WAR and SCP. The whole process takes about 50 seconds. Is
there a way to set a delay on the auto-deploy from the time Tomcat
sees the new WAR in the directory until it actually tries to deploy
it, or is there some other way to keep Tomcat from trying to deploy
before the whole file reaches the server?

I had this exact problem. it was easy to fix -- my ISP / managed host
added some incorrect settings in one of the conf files server.xml or
the main web.xml. I cleaned up these files by reverting to the
example versions and the problem went away
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top