2

I've been giving this thing a try for the last 3 hours and nothing. I need to drop a new war and have tomcat autodeploy it. It is not happening. Here is my simplified configuration:

server.xml

<Engine name="Catalina" defaultHost="localhost">
  <Host name="something.com" appBase="/var/www/something.com/webapps"
        unpackWARs="false" autoDeploy="true" 
        xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="application.war" debug="0" reloadable="true">
      ... some realm and data source stuff here
    </Context>
  </Host>
</Engine>

When I start tomcat everything works great. I have tried two approaches:

  1. Copy a new war using scp in the location.
  2. Touching /var/www/something.com/webapps/application.war.

In both cases I can see catalina.err with the same message:

INFO: Undeploying context [/application]

Without a corresponding

INFO: Deploying web application archive application.war

which I get when I restart tomcat. I have a feeling this is because it is not inside the CATALINA_BASE/webapps but don't know how to proceed. Any help?

6 Answers 6

4

It could be a number of things. Some specific issues I've hit:

(1) File permissions. Make sure the webapps directory, your work directory, the war itself, and any special files it accesses are all readable/writeable by the user running Tomcat (ideally they should be owned by that user).

(2) The previous version isn't fully removed. Try stopping Tomcat, deleting the war and matching folder, copying the new war in, then starting Tomcat. If it works then, the problem might be left over files. (I have an app for example that doesn't completely clean itself up).

(3) The app might not be initializing properly due to issues with the app. If the war deploys automatically into a folder, autodeploy is working, but the app didn't fully initialize. Look for log messages. Depending on your app, this might be in tomcat/logs, the current directory, or standard out. If you can, change the log properties (e.g. log4j.properties file) to show debug level messages.

(4) Permgen mememory problems. When you reload an app in Tomcat, it uses up Permgen memory. By definition, this can't be recovered. Reload too much, and Tomcat will crash with an out-of-memory error (you can usually see this in your logs). Either configure more permgen, or better yet, shut off/restart Tomcat when redeploying an app.

http://wiki.apache.org/tomcat/OutOfMemory

0

I think the culprit is the unpackWARs="false"

From a recent posting on stackoverflow, it was found that unpackWARs="false" causes the new version of the WAR is not detected. Any specific reason it is false?

2
  • I'm not unpacking so that I don't have to deal with another directory full of files. Will try with the unpackWARs="true" to see if that helps. In any case, when the new war is detected, is the previous contents of the unpacked directory erased and replace? Can files be left over from the previous war? Oct 25, 2010 at 14:53
  • @rmarimon: yes, i'm not sure what happens to any deleted JSPs etc from a previous exploded war.
    – JoseK
    Oct 26, 2010 at 8:06
0

Shouldn't it be docBase="application" not docBase="application.war"? If I understand correctly this will cause Tomcat to first look for a folder /var/www/something.com/webapps/application/ and if that doesn't exist look for /var/www/something.com/webapps/application.war

0

If you are using maven, in pom.xml you can set a tag like

<properties>
    <local.tomcat.autodeploy.folder>//pathtoTomcatWebapp folder</local.tomcat.autodeploy.folder>
            <local.build.finalName>nameOfContext</local.build.finalName>
            <localonly>true</localonly>

        <dev.tomcat.autodeploy.folder>specify location</dev.tomcat.autodeploy.folder>
        <dev.build.finalName>nameOfContext</dev.build.finalName>


</properties>
0

Though this is an old thread, I just wanted to pointed out one thing. In IDE right click the server and look for server locations and select Use Tomcat Installation. This will take control of installed location and will explode the war.

0

I was facing this issue on official Tomcat docker container. With

<Host name="localhost"  appBase="webapps"  unpackWARs="true" autoDeploy="true">

in my server.xml, whenever I copied *.war file into appBase folder, it was able to detect and displayed in Manager's page, but was not able to deploy it. Upon clicking Start button , it was deployed, but that's not the target. From Tomcat's HowTos in official documentation, in section Deploying on a running Tomcat server, I got and tried the idea to copy the Exploded form of my war file to appBase folder and it worked. I still can't figure-out that why it is unable to explode the war file in autoDeploy and unpackWARs are true. But giving it and unpacked war file (Exploded form) is like helping the tomcat server to deploy it. Here is my command line to copy it to docker's container:

docker cp "D:\MyMavenProject\target\MyProject-0.0.1-SNAPSHOT\" tomcat_srvr:/usr/local/tomcat/webapps/MyProject-0.0.1-SNAPSHOT

tomcat_srvr is the name of my Tomcat Docker container.

Hope this will help others;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .