Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : J2EE : JSP : Help, the Testservlet class not running in browser with tomcat 4.1.18 Signup · Login
Author Thread
Help, the Testservlet class not running in browser with tomcat 4.1.18
Posted in tutorial: Introduction to Java Servlets, Developing your first Java Servlet
·  zaku
User
Joined: 15 Mar 2003
Total Posts: 2
Help, the Testservlet class not running in browser with tomcat 4.1.18
Posted: 15 Mar 2003
Hi!! Mr. Khan

I am new with web programming such as servlet, J2EE and Tomcat, but I know java quite well.

I have problem with my Tomcat ver 4.1.18, which can not call my servlet.

I had read your lessons about servlet ( thanks for the lessons for Tom Cat and servlet :) ).

I followed all your instruction from installing the TomCat Path :
CATALINA_HOME : C:\jakarta-tomcat-4.1.18
JAVA_HOME : C:\jdk1.3.0_02

I Edit server.xml file which is present in the /conf folder of Tomcat 4.1.18

</Host>
</Engine>
</Service>

I add following line as you mentioned exactly above </Host> code, without delete or modify any other code:

<Context path="/star" docBase="star" debug="1" reloadable="true"/>

The First JSP is running well.

I continue with the first servlet:

Also followed your instruction, I put your TestServlet.java to the folder

C:\jakarta-tomcat-4.1.18\webapps\star\WEB-INF\classes\com\stardeveloper\servlets\

and compile with
javac -classpath c:\jakarta-tomcat-4.1.18\common\lib\servlet.jar TestServlet.java

and start my Tomcat server and open the browser to

http://localhost:8080/star/servlet/com.stardeveloper.servlets.TestServlet

but I got error message in browser like this

HTTP Status 404 - /star/servlet/com.stardeveloper.servlets.TestServlet

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

type Status report

message /star/servlet/com.stardeveloper.servlets.TestServlet

description The requested resource (/star/servlet/com.stardeveloper.servlets.TestServlet) is not available.


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

Apache Tomcat/4.1.18


I can not solve the problem. Can you help me to solve the problem, please????,
Do I need to create the web.xml, also ???.

Since I am new to Web programming, I also would like to ask you is there actually
Do I need J2EE if I use TomCat??.

I am sorry If I asked many question, since I am new leaner with web programming.

Thank you very much anyway.





·  fgalan
User
Joined: 15 Apr 2004
Total Posts: 1
web.xml
Posted: 15 Apr 2004
Try web.xml something like below. In any event refer to conf/web.xml for details.

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<display-name>TestSite</display-name>
<description>TestSiteServletTest</description>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>com.stardeveloper.servlets.TestServlet</servlet-class>
<init-param>
<param-name>Name</param-name>
<param-value>Frank Galan</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>

fgalan
·  Faisal Khan
AdminAdminAdminAdmin
Joined: 24 Sep 2002
Total Posts: 547
Re: Help, the Testservlet class not running in browser with tomcat 4.1.18
Posted: 28 Oct 2007
The JSP spec and Tomcat have been updated since the tutorial was originally written, that is why you received the 404 error. I have updated the tutorial yesterday for JSP's latest spec 2.1 and Tomcat 6.0.14. Please read the tutorial again and follow all the steps, and this time you will not receive any 404 errors.

Faisal Khan.
Stardeveloper.com

Users Who Have Visited This Thread In Last 24 Hours
4 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.