• Post Reply Bookmark Topic Watch Topic
  • New Topic

deploying servlet

 
Pavlos Chatzidimitriou
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all i just started reading the "Head First Servlets and JSP" book and when i want to deploy the first servlet in tomcat i got a 404 resource not found error.I am using ubuntu linux where i have installed netbeans 6.1(as user) with the integrated tomcat 6.0.16 and there i just put a directory ch1 in the tomcat's webapps folder with the WEB-INF folder and there is my web.xml and the classes folder with the Ch1Servlet.class .Here is the web.xml file :

I start tomcat with the startup.sh script ok (without running netbeans) and the servlets examples and the jsp examples are working ok.Anyone has an idea why tomcat can't find the servlet?
 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your Ch1Servlet.class inside a package? If it is, then you should put the package name in your <servlet-class> in web.xml.
 
Shahnawaz Shakil
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pavlos,
How you are calling this servlet. Is it by action method in some jsp?
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to remove the space from <servlet-name> parameter.

<servlet-name>Chapter1Servlet</servlet-name>
 
Pavlos Chatzidimitriou
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.No my Ch1Servlet.class isn't inside a package.Here is the Ch1Servlet.java file

I am calling the servlet with the below command

I checked the web.xml file and it doesn't have a space before servlet-name.Any suggestions?
 
Debendra nayak
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pavlos, can you try with http://localhost:8080/ch1/servlet/Serv1
 
srinivas srinivasmeenavalli
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you deployed ch1.war into tomcat.Are you able to see ch1 folder
in tomcat/Webapps ? You can verify deployment through Tomcat web application manager.

Refer http://www.netadmintools.com/art340.html
 
srinivas srinivasmeenavalli
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of Tomcat your are using ?
you have to change encoding value in web.xml to "ISO-8859-1" from "ISO-8851-1" .
<?xml version="1.0" encoding="ISO-8859-1"?>
Refer another post http://www.coderanch.com/t/87868/Tomcat/Unable-Run-Servlet-Apache-Tomcat
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Debendra", please check your private messages for an important administrative matter.
 
Pavlos Chatzidimitriou
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your answers.I tried but no luck.I successfully created a user to manage tomcat and in the web application manager i see that the ch1 application isn't running and when i click start i get that
FAIL - Application at context path /ch1 could not be started
.I also changed the to
but still the same error.Does anyone have a clue how to fix this?
 
Pavlos Chatzidimitriou
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved.I just changed the encoding in UTF-8 in web.xml and is working

Thanks for all your answers and time spend to solve my problem
 
Ken Butters
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had exact same error. I changed from :

encoding="ISO-8851-1"

to

encoding="ISO-8859-1"

It worked. I think it may be a typo in the book.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!