War deployment on Tomcat takes ages

后端 未结 6 1686
猫巷女王i
猫巷女王i 2021-02-07 23:11

I have a Grails application, built to a war file (~30mb). When I attempt to deploy the war file on Tomcat 6 via the application manager, it takes upwards of 10 minutes to deploy

相关标签:
6条回答
  • 2021-02-07 23:25

    It's not always that you have sufficient access rights to manually put files in the webapps folder -- you are supposed to use the Tomcat Application Manager for .war file deployment, and need to make it work.

    For me, it has been common that the process of uploading of a .war file to the server cannot complete; it gets stuck somewhere in the middle and the file is only partially uploaded to the server, no matter how many times I retry. In such situations, I have found it worthwhile to try another browser. For instance, I've found myself stuck using Google Chrome but once I switched to a freshly started Firefox browser, things worked out.

    0 讨论(0)
  • 2021-02-07 23:27

    As noted I would copy the war to the webapps folder and let tomcat do the deployment, its also quicker saving you time.

    Both Tomcat and Jetty will support a hot deploy. They simply monitor the deploy directory for changes, so you can just copy the .war file into that directory, and the server will undeploy/redeploy.

    If using a remote server check the lag is not the time take to upload the war to a remote server over the network.

    0 讨论(0)
  • 2021-02-07 23:32

    Definitely check the Tomcat logs for any errors/warnings.

    You probably have some expensive/sensitive code logic in one of the ServletContextListeners. They are usually initialized during startup. If so, then I would debug/profile it for any performance matters/leaks.

    0 讨论(0)
  • 2021-02-07 23:39

    Don't use application manager. My way is to upload it somewhere out of the webapps directory and then copy it to webapps directory. Takes a lot less of deplyoment time.

    0 讨论(0)
  • 2021-02-07 23:48

    I upload the WAR to my home directory, cd to /usr/local/tomcat, then run the following commands:

    bin/shutdown.sh
    rm webapps/ROOT.war
    rm -rf webapps/ROOT
    cp ~/ROOT.war webapps
    bin/startup.sh
    
    0 讨论(0)
  • 2021-02-07 23:48

    This may be relate to this BUG of JDK

    I readed this article, Tomcat7 starts too late on Ubuntu 14.04 x64 and resolved my problem.

    Try to resolve it by replacing

    securerandom.source=file:/dev/urandom  
    

    with

    securerandom.source=file:/dev/./urandom 
    

    in $JAVA_PATH/jre/lib/security/java.security

    0 讨论(0)
提交回复
热议问题