• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3502
  • Last Modified:

Deploying .war files on shared cpanel server

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 http://domainname.com

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

Directory structure:- of  /home/username/www
images
index.jsp
js/
jsptest.jsp
META-INF/
WEB-INF/
----------classes
             ----appname/
                   ---hibernate/
                          ---All class files
                   ---web/
                          ---controller/
                                  ---All class files
----------.htaccess
----------jsp/
             ----home.jsp
             ----include.jsp
----------lib/
             ----all jar files
----------appname-servlet.xml
----------web.xml





0
shaunak
Asked:
shaunak
  • 6
  • 4
1 Solution
 
sompol_kiatkamolchaiCommented:
How do you know that Tomcat not load web.xml?
0
 
shaunakAuthor Commented:
Becos what ever changes I do or even if the web.xml is not present it gives the same error.
0
 
sompol_kiatkamolchaiCommented:
what changes you have made to web.xml?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
shaunakAuthor Commented:
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
0
 
shaunakAuthor Commented:
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 http://domainname.com:port/appname

But my main aim is to make the app work as http://domainname.com
0
 
sompol_kiatkamolchaiCommented:
Hi,

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,
Sompol
0
 
shaunakAuthor Commented:
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 :

                           compression="on"
                           compressionMinSize="2048"
                           noCompressionUserAgents="gozilla, traviata"
                           compressableMimeType="text/html,text/xml"
        -->

    <!-- 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" />
    -->


0
 
sompol_kiatkamolchaiCommented:
What changes you have made?
Is it working before change?
0
 
shaunakAuthor Commented:
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 site.com:8080
  • If you deploy through web.xml it will work on site.com
  • If you deploy through war file then server will extract the contents tomcat/work/catalina/site.com
  • 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
0
 
shaunakAuthor Commented:
See my comment to make it working
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now