Results 1 to 11 of 11
  1. #1

    Question Java servlet issue in Cpanel

    Hi,

    I've installed the Tomcat JSP plugins in Cpanel, and one of my clients want to run a servlet, after enabling the jsp support from WHM for that client, he could only run jsp but not servlet, keep getting the "404 Error" while accessing the servlet file at http://clientdomain.com/servlets/servlet.class

    the home directory for putting the servlet file is /home/username/public_html/servlets/

    Any solution for that? Since it's a plugins and I don't know what kind of configurations is different from the original Tomcat JSP, thanks!

  2. #2
    Join Date
    Mar 2002
    Posts
    1,003
    Make sure he maps the servlet in his web.xml file.

  3. #3
    Join Date
    May 2001
    Posts
    1,593
    You have to access the servlet by class name only. No .class suffix.

    So access it like this: http://www.domain.com/servlets/MyServlet

    Peter

  4. #4
    when I try to access http://domain.com/servlets/Myservlet (without the .class) I got Tomcat Error 404....

  5. #5
    Join Date
    May 2001
    Posts
    1,593
    What does the error log say?

    (dumb question: You didn't just use MyServlet, did you?)

    Peter

  6. #6
    I can't see the error of jsp from error log, but I get the following error in browser:

    Apache Tomcat/4.0.3 - HTTP Status 404 - /servlets/CSMailForm

    --------------------------------------------------------------------------------

    type Status report

    message /servlets/CSMailForm

    description The requested resource (/servlets/CSMailForm) is not available.

  7. #7
    Join Date
    May 2001
    Posts
    1,593
    A couple of questions,

    1)Did you make sure the java installation works? (that it works with other client's sites)

    2)Have you mapped /servlets to be tthe path to execute servlet?

    3)Have you verified that the file exists and its permission is set correctly?

    Peter

  8. #8
    replying your questions...

    1) I install the Tomcat JSP plugins from Cpanel, jsp is not installed on every virtual sites, I have to enable jsp for a client in WHM

    2) I checked the Apache conf file, after enabling jsp support from Cpanel, it automatically added the lines:

    JkMount /*.jsp ajp13
    JkMount /servlet/* ajp13
    JkMount /servlets/* ajp13

    so servlet is runable in /servlet or /servlets

    3) Yes it's exist and it's already chomd to 755

    Originally posted by ckpeter
    A couple of questions,

    1)Did you make sure the java installation works? (that it works with other client's sites)

    2)Have you mapped /servlets to be tthe path to execute servlet?

    3)Have you verified that the file exists and its permission is set correctly?

    Peter

  9. #9
    Join Date
    Apr 2001
    Location
    Paradise
    Posts
    11,868
    did you mapped your servlets in the web.xml in the WEB-INF folder?
    Shared Web Hosting - Reseller Hosting - Semi-Dedicated Servers - SolusVM/XEN VPS
    LiteSpeed Powered - R1Soft Continuous Data Protection - 24/7 Chat/Email/Helpdesk Support
    Cpanel/WHM - Softaculous - R1soft Backup - Litespeed - Cloudlinux -Site Builder- SSH support - Account Migration
    DowntownHost LLC - In Business since 2001- West/Center/East USA - Netherlands - Singapore

  10. #10
    Join Date
    Mar 2002
    Location
    Servers
    Posts
    806
    jasonm,

    try this:

    1. create folder WEB-INF in /home/username/public_html

    2. create sub-folder /home/username/public_html/WEB-INF/classes

    3. put your servlet class files in folder "classes"

    4. you do not need to chmod 755

    5. create a web.xml in WEB-INF where you will need to map the servlet. you can find more details in docs or examples. but anyway here's something to start:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    
    <web-app>
    
        <servlet>
          <servlet-name>
             HelloWorldServlet
          </servlet-name>
          <servlet-class>
             HelloWorldServlet
          </servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>
                HelloWorldServlet
            </servlet-name>
            <url-pattern>
                /HellowWorldServlet
            </url-pattern>
        </servlet-mapping>
    
    </web-app>
    Hope this helps
    Dedicated Servers cPanel Shared/Reseller Hosting
    VPS Backups Cloud Colocation Managed Services
    Webx Networks Serving world wide since 1997

  11. #11
    not working for me
    Last edited by acoaster; 07-05-2002 at 03:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •