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.

Tomcat directory structure

Discussion in 'General Discussion' started by labahost, Oct 1, 2007.

  1. labahost

    labahost Well-Known Member

    Joined:
    May 4, 2004
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    What is tomcat directory structure?
    After I've installed Tomcat with easyapache 3 and clicked "install servlets" for an account, so now I can run jsp pages, but how can I install servlets, what is the directory structure?
    Is it possible to deploy war files with tomcat? (I was able to do it with modresin)
     
  2. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,281
    Likes Received:
    37
    Trophy Points:
    48
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    If you have installed Tomcat via WHM, then under WHM / Account Functions you'll find the option to 'Install Servlets'

    If you click on 'Install Servlets', and then select a domain and click Install, it will create the following folder structure in the public_html directory of that account:

    /WEB-INF
    /WEB-INF/classes
    /WEB-INF/lib

    It will also install a jsptest.jsp file in public_html

    In your httpd.conf it will add the following under the VirtualHost directive for that domain:
    <IfModule mod_jk.c>
    JkMount /*.jsp ajp13
    JkMount /servlet/* ajp13
    JkMount /servlets/* ajp13
    </IfModule>

    On one site where a customer installed a Java servlet they installed it in a subdirectory called /billing. They then created /billing/WEB-INF , /billing/WEB-INF/lib , /billing/WEB-INF/classes and /billing/WEB-INF/lib. Their .jar files are in /billing/WEB-INF/lib. Their index.jsp file is in /billing/index.jsp.

    I'm not a Java person, so I don't know how things are supposed to go. But it looks like you can put your .jsp files in any directory and just make sure you have a WEB-INF under that directory containing all of your java classes, jar files, etc. in the appropriate directories.


    Mike
     
    #2 mtindor, Oct 1, 2007
    Last edited: Oct 1, 2007
  3. labahost

    labahost Well-Known Member

    Joined:
    May 4, 2004
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Thank you very much Mike.
    Does anybody know if I'll modify that fragment in http.conf to add something like this:
    JkMount /*.* ajp13 will modification persist after CPanel update? Or is there another way to launch servlets from root, like jsps? (may be by somehow modifying local web.xml ?)
     
  4. labahost

    labahost Well-Known Member

    Joined:
    May 4, 2004
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    update

    I think that Mike response was regarding Tomcat added by previous version of CPanel as plugin. (what I mean: there is no ajp13 substring in httpd.conf)
    Latest version of CPanel with Easyapache 3 looks like have a completely different way of configuring tomcat with apache. Can anybody post some help on it?
     
    #4 labahost, Oct 2, 2007
    Last edited: Oct 2, 2007
  5. labahost

    labahost Well-Known Member

    Joined:
    May 4, 2004
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Sorry for replying to me again, but it seems that I found a solution:
    You should edit the file in
    /usr/local/apache/conf/userdata/std/$version_of_apache/$username/$domainname/

    where
    $version_of_apache is 1 for 1.3 and 2 for apache 2.0 and 2.2

    the file name is cp_jkmount.conf

    then you should restart httpd
     
  6. asiams

    asiams Well-Known Member

    Joined:
    May 28, 2003
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Hokkaido, JAPAN
    New Version of Tomcat

    You are right.

    Here is the newly added lines when Install Servlet is done to a domain:

    Include "/usr/local/apache/conf/userdata/*.conf"
    Include "/usr/local/apache/conf/userdata/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/*.conf"
    Include "/usr/local/apache/conf/userdata/std/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/2/*.conf"
    Include "/usr/local/apache/conf/userdata/std/2/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/2/aljlmnbe/*.conf"
    Include "/usr/local/apache/conf/userdata/std/2/aljlmnbe/seishojuku.jp/*.conf"

    It just adds bunch of Include statements in httpd.conf.

    hope this helps.

    asiams
     
  7. FeeL

    FeeL Well-Known Member

    Joined:
    Apr 17, 2004
    Messages:
    135
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Rio de janeiro
    cPanel Access Level:
    Reseller Owner
    got it, but the /servlet/ is not working

    Now I understood how apache 2.x works with tomcat.
    I hope that this gets stable from now on :)

    Yet, my domains are not working properly with the www.domain/servlets, showing this

    HTTP Status 404 - /servlets/

    type Status report

    message /servlets/

    description The requested resource (/servlets/) is not available.
    Apache Tomcat/5.5.25

    What else can be checked?

    Thanks!:p
     
Loading...

Share This Page