The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unable to run jsp pages with www.domain.com

Discussion in 'General Discussion' started by bryanabhay, Aug 24, 2007.

  1. bryanabhay

    bryanabhay Active Member

    Joined:
    Aug 14, 2006
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    We have installed Tomcat on our Vps server under WHM 11.2.0 cPanel 11.8.0-R16295

    whenever we install Servlet for any new domain the jsp pages did not work.

    After verification i found that the jsp pages are not working with http://www.domain.com/

    And if i run http://domain.com/jsptest.jsp then it works well.

    I found that the host name entries in servers.xml was not getting created.

    I tried to reinstall the tomcat but no use !!

    Can anybody suggest more about it ?

    ~ Bryan
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    This is fixed in our EDGE tree and will be available in the other trees once cPanel 11 stage 2 happens.
     
  3. iamsuraj00

    iamsuraj00 Registered

    Joined:
    Jul 21, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    open server.xml and the add the below lines after the </context>

    <Alias>
    www.domain.com
    </Alias>


    domain.com would be your domain name. Restart Tomcat from WHM and you will be all set.

    Suraj
     
  4. andyaav

    andyaav Member

    Joined:
    Jan 1, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    tomcat not working with www

    Hi Suraj,

    I have added Alias in server.xml but still having same problem. Any idea?


    <Alias>
    www.domain.com
    </Alias>
     
  5. lyspider

    lyspider Registered
    PartnerNOC

    Joined:
    Aug 1, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Fix to jsp pages that doesn't work with www

    Hello,

    I had this problem too, lucky today I have found the fix, for unknown reason for mean when you install server let it doesn't create the host for the www.domain.com, in server.xml you can fix it by copying:

    steps:

    1- open server.xml

    2- search for the domain name that you used to install the serverlet on, you will find only:

    <Host name="domain.com" appBase="/home/user/public_html">
    <Context path="" reloadable="true" docBase="/home/user/public_html" debug="1"/>
    <Context path="/manager" debug="0" privileged="true"
    docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
    </Context>
    </Host>

    3- copy and paste that below the current and do add the www as following:

    <Host name="www.domain.com" appBase="/home/user/public_html">
    <Context path="" reloadable="true" docBase="/home/user/public_html" debug="1"/>
    <Context path="/manager" debug="0" privileged="true"
    docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
    </Context>
    </Host>

    4- restart tomcat through cpanel

    it works with me and it is fix in this way, hope that helps you :)

    Regards

    hadi
     
  6. neonix

    neonix Well-Known Member

    Joined:
    Oct 21, 2004
    Messages:
    124
    Likes Received:
    2
    Trophy Points:
    0
    jsp files with www

    Hi,

    Add the alias command as shown below and restart tomcat. This works perfectly.

    Make a backup of this file as the next time you add a new account, all the alias commands may have to be reinserted.

    <Host name="domainname.com" appBase="/home/user/public_html">
    <Alias>www.domainname.com</Alias>
    <Context path="" reloadable="true" docBase="/home/user/public_html" debug="1"/>
    <Context path="/manager" debug="0" privileged="true"
    docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
    </Context>
    </Host>
     
  7. sibu

    sibu Member

    Joined:
    Jul 14, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I have fixed the same problem .. Hope the steps will help you...

    # installed tomcat via plugin manager
    # recompiled apache.
    # installed servlets for that domain
    Check for the correct Host details at : /usr/local/jakarta/tomcat/conf/server.xml

    <Host name="domainname.com" appBase="/home/username/public_html">
    <Alias>www.domainname.com</Alias>
    <Context path="" reloadable="true" docBase="/home/username/public_html" debug="1"/>
    <Context path="/manager" debug="0" privileged="true"
    docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
    </Context>

    # Make sure that you have below line in the Virtual Host entry of the domain name

    Include /usr/local/apache/conf/userdata/std/1/username/domainname.com/*.conf

    # added the line "LoadModule jk_module libexec/mod_jk.so" in httpd.conf
    # Ran /usr/local/apache/bin/apachectl configtest
    # restarted tomcat and httpd....

    Fixed it for me... :) :)
     
  8. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator

    That is incorrect. Tomcat should not be installed via the WHM plugins interface. It should only be installed via EasyApache (or manually if you must). The version in WHM Plugins is broken and out of date.

    Once Tomcat is installed via EasyApache, you can configure servlet support on a domain using the Add Servelets interface in WHM or via command line /scripts/addservlets Both functions will add the correct entries to server.xml and add the proper include to the VirtualHost.
     
  9. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Will that support servlets by default and auto deployment of WAR files?

    Code:
           <Host name="domain.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" reloadable="true">
              <Alias>www.domain.com</Alias> 
              <Context path="" reloadable="true" docBase="/home/domain/public_html" debug="0" privileged="true" autoDeploy="true" liveDeploy="true">
    		<Resource name="jdbc/user" auth="Container" type="javax.sql.DataSource"
                   maxActive="100" maxIdle="30" maxWait="10000"
                   username="XXXX" password="XXXX" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/XXXX"/>
    
              </Context>
           </Host>
    I have to edit the default entry to the entry above, to make it working properly, moreover every time we add servlets to a new domain all existing entries are switched to default, so we have to edit them again.

    Is there a template somewhere from where WHM read and write them?
     
  10. VirtuaLira

    VirtuaLira Well-Known Member

    Joined:
    Feb 1, 2004
    Messages:
    148
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Chile
    I checked all the settings, buy still taking the 404 error...

    Tomcat is working... but... why the 404 error??
     
  11. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    At this time there is no template. However we are currently working on a method of preserving such changes. This feature is currently in the EasyApache test branch. Once the feature is ready for production, it will be announced on changelog.cpanel.net (however I'll mark this thread in other to also update here).
     
  12. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    kenneth any update on this issue?
     
  13. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    There is allowance now for using a template-type system for preserving changes. Please note that revamping our support Tomcat is scheduled, so this system may be done away with.

    That said, recent versions of EasyApache have this:

     
  14. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    On a new server I tried using this template method by creating
    /var/cpanel/templates/tomcat/server.xml.host_entry.default

    Had my desired entries there, it seems to be working to create entries in server.xml as per the template, but it is also making a double entry for last added account.

    So if firstdomain.com was already there then while adding servlets for seconddomain.com it will add another entry for firstdomain.com and while adding thirddomain.com it will add another entry for seconddomain.com.

    Now since there are double entries for a domain Services will become unavailable and this error is there in /usr/local/jakarta/tomcat/logs/catalina.err:


    Also when terminating an account through WHM it won't remove its entry from server.xml

    server.xml is at /usr/local/jakarta/apache-tomcat-5.5.25/conf

    Any idea what's wrong in there or that's a bug in cPanel system?

    Any solution to correct these issues?
     
  15. boughtonp

    boughtonp Member

    Joined:
    Sep 1, 2007
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    there
    cPanel Access Level:
    Root Administrator
    Has the list of variables of the server.xml.host_entry.default been expanded yet?

    I do not want appbase and docbase in "/home/{user}/webapps" directory, but would like for server.xml to be auto-generated.
     
Loading...

Share This Page