Deploying .war files on shared cpanel server

Posted on 2009-12-20
Last Modified: 2013-12-02
I have a war file at /home/username/www/appname.war
My home directory: /home/username/www
Servlet dir: /home/username/www/WEB-INF

When I extract war files every things get extracted at proper location but the tomcat server dosen't load my web.xml file.

If i ask the server ppl to install my war file, it gets installed at http://ip:8080/appname

I want to run the application on

Tomcat Version: Apache Tomcat/5.5.28
JVM Version:1.6.0_17-b04
CPanel Shared server.
servlets installed for the

Directory structure:- of  /home/username/www
                          ---All class files
                                  ---All class files
             ----all jar files

Question by:shaunak
    LVL 11

    Expert Comment

    How do you know that Tomcat not load web.xml?
    LVL 8

    Author Comment

    Becos what ever changes I do or even if the web.xml is not present it gives the same error.
    LVL 11

    Expert Comment

    what changes you have made to web.xml?
    LVL 8

    Author Comment

    It has nothing to with the changes. Even if i remove the web.xml it is showing the same error.

    If i deploy the same in $CATALINA_HOME/webapps/appname it works well as http://ip:port/appname

    I want that http://ip:port/appname to work as http://domainname
    LVL 8

    Author Comment

    Now when I tried http://domainname:port/manager it gave me a manager menu. I then tried to deploy the war file with context path as /appname and gave the path of war file and to my surprise it worked. So now I can access the application by

    But my main aim is to make the app work as
    LVL 11

    Accepted Solution


    To remove :port is to change listening port to 80 which is default port for http.

    Open server.xml in %TOMCAT_HOME%\conf directory and edit the <Connector> element.
    For SimpleTcpConnector, change the sub-element "port" value to 80.

    Hope this help,
    LVL 8

    Author Comment

    I tried to change that but it doent work. It shows 404 page after tomcat restart. Here is a part of my server.xml

       <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
        <Connector port="8080" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" />
        <!-- Note : To disable connection timeouts, set connectionTimeout value
         to 0 -->

            <!-- Note : To use gzip compression you could set the following properties :

                               noCompressionUserAgents="gozilla, traviata"

        <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
        <Connector port="8443" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" disableUploadTimeout="true"
                   acceptCount="100" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />

        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009"
                   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

        <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
        <!-- See proxy documentation for more information about using this. -->
        <Connector port="8082"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" acceptCount="100" connectionTimeout="20000"
                   proxyPort="80" disableUploadTimeout="true" />

    LVL 11

    Expert Comment

    What changes you have made?
    Is it working before change?
    LVL 8

    Author Comment

    Its working now.
    The correct way to make it working is:-
    • Install tomcat admin and create a user for the domain
    • Upload all your content with proper web.xml into your www folder
    • Browse site:8080/manager/install and click on redploy
    • Your site will be working.
    Some points I learned :-
    • If you put .war file in www folder, it gets auto deployed but it will run as
    • If you deploy through web.xml it will work on
    • If you deploy through war file then server will extract the contents tomcat/work/catalina/
    • If you edit tomcat/conf/server.xml to listen to port 80 instead of 8080 then all your request will be handled by tomcat. php, images, normal html all be handled by tomcat. Tomcat is not that good in response for non java/jsp content.
    • If you use mod_jk with apache, then apache will take all the traffic and then only jsp request will be forwarded to tomcat thru 8009 internal port. This is done by mod_jk
    LVL 8

    Author Closing Comment

    See my comment to make it working

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now