Results 1 to 4 of 4

Thread: running tomcat on whm

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    2

    Default running tomcat on whm

    ok i am here looking for help. i have read some great stuff, but unfortunately, most everything i am finding is so dated, none of it works.

    Situation:
    Running Dedicated Server with whm/cpanel

    Account Requirement
    Use Tomcat

    I have installed tomcat using easyapache script builder, and tomcat appears in the services running. Tomcat is not my issue here i do not think.

    So ok we have tomcat running can be verified calling http://domain.com:8080 which loads the default app from /ROOT of tomcat server

    ok all of that is well. though we dont want to tell people to put the :PORT on the url of the site

    ok steps taken:

    back to easyapache, and though there is nothing that actually says mod_proxy, there is an option for proxy, which appears to be selected by default.

    ok we can hit httpd.conf and /mod_proxy

    and we see:


    <IfModule mod_proxy.c>
    ProxyRequests On
    </IfModule>

    ok since i am digging, i want to look to see if the module is loaded?

    command: /usr/local/apache/bin/httpd -l

    shows me:

    root@themachine [/usr/local/apache/conf]# /usr/local/apache/bin/httpd -l
    Compiled in modules:
    core.c
    mod_authn_file.c
    mod_authn_default.c
    mod_authz_host.c
    mod_authz_groupfile.c
    mod_authz_user.c
    mod_authz_default.c
    mod_auth_basic.c
    mod_include.c
    mod_filter.c
    mod_log_config.c
    mod_logio.c
    mod_env.c
    mod_expires.c
    mod_headers.c
    mod_setenvif.c
    mod_version.c
    mod_proxy.c
    mod_proxy_connect.c
    mod_proxy_ftp.c
    mod_proxy_http.c
    mod_proxy_scgi.c
    mod_proxy_ajp.c
    mod_proxy_balancer.c
    mod_ssl.c
    prefork.c
    http_core.c
    mod_mime.c
    mod_status.c
    mod_autoindex.c
    mod_asis.c
    mod_info.c
    mod_suexec.c
    mod_cgi.c
    mod_negotiation.c
    mod_dir.c
    mod_actions.c
    mod_userdir.c
    mod_alias.c
    mod_rewrite.c
    mod_so.c

    ok going further, and this is all from reading online docs, and trying to make this work, so if my information is overwhelming, i apologize, but i have been going at this for three days now;

    i created the account on whm

    then i went to /usr/local/httpd/conf
    vi httpd.conf

    /accountName

    VirtualHost shows up, and from what i have read, i am to create a new VirtualHost

    <VirtualHost IP:PORT>
    ServerName hostname.TLD.ext
    DocumentRoot /path/to/apache-tomcat/webapps/? (this is where i get lost as well)
    ProxyPass / http://subdomain.domainname.com:8080/
    ProxyPassReverse / http://subdomain.domainname.com:8080/
    </VirtualHost>

    ok this dont work

    well not on this particular instance, i believe i have the exact same build on another machine, and alas, the jsp apps are loading on tomcat with one minor glitch. will get into that momentarily.

    so on this particular instance, i am not getting any forwarding at all. but i can call the url:PORT, and tomcat loads up.


    **********************************************************************************
    to iterate what i was talking about on the install on the other machine. i set up a subdomain, and tried everything i could think of when trying to get it to go to a specific app other than /ROOT. ended up putting a redirect from /ROOT/index.html --> to custom app. and that is not really acceptable, because now, we have http://domain.com/APPNAME when calling the domain where the ProxyPass was setup.

    now here is where it gets outside of the realm of my understanding

    if i call another subdomain on that same server, it will resolve to the customAPP on webapps/MYAPP

    yeah dont get that one, when that specifc account does not have a directive in its <VirtualHost> container to resolve to :8080

    so it may be that i have some wrong there.


    ok now that i have rambled. i will state what i am trying to accomplish:

    use tomcat and set it up so that when calling the domain with the jsp app, then the index of that specific app will appear.

    i.e.

    Three jsp or servlet apps:

    http://domain1.com --> jsp app 1

    http://domain2.com --> servlet 1

    http://domain3 --> jsp app 2


    Question:
    how can i tell if mod_proxy is working correctly?

    do i set the ProxyPass and ProxyPassReverse on each <VirtualHost>

    how do i specify DocumentRoot when considering the tomcat server?

    ok any help will be greatly appreciated. and sorry for the long-windedness. but i have tried, and now seeking help.

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: running tomcat on whm

    First of all, /usr/local/apache/conf/httpd.conf file (the Apache configuration file) shouldn't be edited directly for the VirtualHost section. Editing that file will not correct any issues with Tomcat. The file that determines what happens for Tomcat is /usr/local/jakarta/tomcat/conf/server.xml file, which has entries created for domains when they are added using WHM > Install Servlets location.

    Next, if you have a site not working using http://domain.com to load the application, it is possible the user needs to extract the war file archive into public_html directly rather than uploading the war file and having it only extract in the tomcat folder at /usr/local/jakarta/tomcat/webapps location. Usually, the default Tomcat setup doesn't have public_html set for war file extraction.

    Otherwise, it might be due to servlet mapping. You might want to consider opening up a ticket to us to have us check what is going on, ensuring to provide specific examples of what site is working and what site is not working.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    2

    Default Re: running tomcat on whm

    Tristan,
    you are very quick to respond, and its very much appreciated. just to clarify what is stated:

    /usr/local/jakarta/apache-tomcat-5.5.34 is what is installed by whm

    so i would presume that is where i should find the /conf/server.xml?

    you lost me on the public_html bit? i am familiar with that being the HOMEPATH on a cpanel account /home/accountname/public_html

    but in tomcat --> /usr/local/jakarta/apache-tomcat-5.5.34/

    i have not found any public locale to place the jsp app.

    in my tests, excluding some custom created app, i have been trying to get /usr/local/jakarta/apache-tomcat-5.5.34/webapps/jsp-examples/(named example) to load up. or for clarity, just to call the domain name in the browser http://domain.com and have it resolve to port 8080 and the default app on tomcat located in /ROOT

    the irony of what you state here is that oddly enough, on the other instance, http://domain.com loads /ROOT which has index.html with a redirect to /MYAPP, the problem with this method is that the url shows up such as --> http://domain.com/MYAPP



    but then you call another domain name that i dont believe to be configured for tomcat, you can call http://domain2.com and it resolves the /MYAPP

    i didnt want to state the domain names i am working with that are showing the variances in functionality. but will upon your request sent a PM so you can visit the two domain.

    the current server i am battling is tomcat[dot]rootbaron[dot]com

    if you call http://domain.com:8080 default tomcat loads /ROOT

    you can also call any of the other apps in /webapps dir.

    so my belief is that tomcat is doing its job, i am lacking in understanding how to set this thing up correctly.

    and since you mention httpd.conf does not require the edits, are you stating that i do not need to use the ProxyPass and ProxyPassReverse either?

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: running tomcat on whm

    Sending a PM wouldn't help to troubleshoot as we need access to the machine itself to check into it. Please submit a free ticket using the link in my signature or via WHM > Support Center > Contact cPanel with specifics.

    As for public_html, a war file that is not extracted in public_html directly won't be viewable on port 80. public_html is referenced in /usr/local/jakarta/tomcat/conf/server.xml file and the tomcat we install is symlinked from /usr/local/jakarta/apache-tomcat-# to /usr/local/jakarta/tomcat locaiton, so let's start using the shorter tomcat symlink that we have rather than the full version name for that path.

    We have discussions on war file extraction at this location:

    http://forums.cpanel.net/f42/how-aut...tml#post636889

    They don't auto deploy with the typical entries we place into server.xml for port 80.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Tomcat and WHM
    By Ken Adams in forum General Discussion
    Replies: 1
    Last Post: 10-16-2008, 04:08 PM
  2. Tomcat is not running after installed
    By Charles.Gao in forum General Discussion
    Replies: 2
    Last Post: 01-28-2008, 08:09 PM
  3. Replies: 5
    Last Post: 03-06-2006, 07:02 AM
  4. Tomcat 5.x on WHM 10.0.0
    By dzalbo in forum General Discussion
    Replies: 1
    Last Post: 02-21-2005, 03:05 PM
  5. Tomcat / JSP running as root?
    By svedo in forum General Discussion
    Replies: 11
    Last Post: 01-27-2004, 11:47 AM
bargain