jasonm
07-03-2002, 05:23 PM
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!
Shyne
07-03-2002, 05:31 PM
Make sure he maps the servlet in his web.xml file.
ckpeter
07-03-2002, 06:31 PM
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
jasonm
07-03-2002, 06:33 PM
when I try to access http://domain.com/servlets/Myservlet (without the .class) I got Tomcat Error 404....
ckpeter
07-03-2002, 06:35 PM
What does the error log say?
(dumb question: You didn't just use MyServlet, did you?)
Peter
jasonm
07-03-2002, 06:38 PM
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.
ckpeter
07-03-2002, 06:42 PM
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
jasonm
07-03-2002, 06:48 PM
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
Jedito
07-04-2002, 01:13 AM
did you mapped your servlets in the web.xml in the WEB-INF folder?
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:
<?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 :)