• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP Status 404 - /ch1/Serv1/

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all

from HFSJ chapter1 page 30 i tried servlet program
its compiling fine
but its showing

HTTP Status 404 - /ch1/Serv1/

type Status report

message /ch1/Serv1/

description The requested resource (/ch1/Serv1/) is not available.



my web.xml is

<?xml version="1.0" encoding="ISO-8851-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>



web.xml is in E:\tomcat\apache-tomcat-5.5.26\webapps\ch1\WEB-INF\web.xml

i dont know where i did mistake

please someone help

thank you
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a guess, but what happens when you use, " <url-pattern>/ch1</url-pattern>" and provided the fully qualified class in " <servlet-class>Ch1Servlet</servlet-class"?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check your url-partern vs requested url. Do they match?
[ June 17, 2008: Message edited by: Pham Hoai Van ]
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where you put this (compiled servlet) class file ? means in which folder.

this should be under WEB-INF classes folder. [ WEB-INF/classes ]
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Saifuddin

Ch1Servlet.class is under

E:\tomcat\apache-tomcat-5.5.26\webapps\ch1\WEB-INF\classes\Ch1Servlet.class
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone indicated the url-patten should match the path in your browser. So if you are using, 'http://.../ch1/Serv1/" to access the resource, I believe the pattern should also be "/ch1/Serv1/ (not just ch1).
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-What url exactly did you type in the browser?
-Did you restart tomcat?
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya, i tried ch1/Serv1 too
but its not working

i restarted the tomcat and the url is http://localhost:8080/ch1/Serv1
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any thing show up in the log file?

Tomcat writes text log files to the TOMCAT_HOME/logs directory.
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Saifuddin

can you please tell me how to look through in the log files
please guide me


catalina.2008-06-18

Jun 18, 2008 9:57:27 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_06\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_06\bin;
Jun 18, 2008 9:57:30 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 18, 2008 9:57:30 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 12656 ms
Jun 18, 2008 9:57:32 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 18, 2008 9:57:32 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
Jun 18, 2008 9:57:33 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jun 18, 2008 9:57:44 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 18, 2008 9:57:49 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 18, 2008 9:57:49 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
Jun 18, 2008 9:57:49 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Jun 18, 2008 9:57:49 AM org.apache.catalina.startup.Catalina start




localhost.2008-06-18

Jun 18, 2008 9:57:38 AM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
Jun 18, 2008 9:57:41 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jun 18, 2008 9:57:41 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jun 18, 2008 9:57:42 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jun 18, 2008 9:57:42 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()



thank you
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all

thank you all. its working fine now.
thanks a lot.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone should code up what is trying to be accomplished as paste it here or email it to the thread owner. If it is not done later today (it is 12:30 AM here), I can do it later. Also, the thread owner should verify that the built-in examples run. These should be at: "http://localhost:8080/examples/servlets/". I am at tomcat version 6.x so the location my be different if you are using version 5.x
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ks Karthe,
How did you do it? what makes it work? To me i guess you servlet name has an issue. i mean a serlet name with a space, "Chapter1 Servlet". how does it look?
i.e.

_________________________________________________________
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>
_________________________________________________________


Juwonlo
SCJP 5.0
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Juwonlo Ibigbami

i think servlet name is justt to link the servlet element with the mapping element.

and my actual problem is with the servlet.
after implementing the doGet properly it works fine.
very silly mistake made me spend a whole day.

thank you
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ks karthe

I have similar problem while running the servlet

HTTP Status 404 - /ch1/

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

type Status report

message /ch1/

description The requested resource (/ch1/) is not available.

------------------------------------------------
Please tell me how did you solved this problem.

Thanks in advance.
[ December 02, 2008: Message edited by: Madhura Choudhary ]
 
Ranch Hand
Posts: 463
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Madhura,

Can you paste your web.xml mapping and the full url you are trying to access in your browser here?
 
Madhura Choudhary
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sai,

My web.xml is,
-------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<servlet>
<servlet-name>Chapter1Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
<servlet-mapping>

<web-app>

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

web.xml is in
C:\Program Files\apache-tomcat-6.0.14\webapps\ch1

the url pattern is,
http:\\localhost:8080\ch1\Serv1

I tried changing my web.xml url pattern to,
<url-pattern>ch1/Serv1</url-pattern>
but still the same problem

Please tell me where i am going wrong ?

Thanks for helping.
 
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ks kathe,

You stated the solution to your 404 problem is:

and my actual problem is with the servlet. after implementing the doGet properly it works fine. very silly mistake made me spend a whole day.

And your original post stated the following problem:

description The requested resource (/ch1/Serv1/) is not available.

Perhaps you can clarify what the real solution/real problem was, because if you don�t implement the correct method in the servlet you will the following 405 error (not 404):

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

Therefore what I getting at is that the 404 error resource not available is NOT solved by implementing the doGet method, so perhaps you could clarify this as now a few developers might think that the �resource not available� error is solved by implementing the doGet method and this isn�t the case.
[ December 03, 2008: Message edited by: Justin Rundle ]
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Madhura Choudhary,

You are reciecving a 404 error for the requested resource (/ch1/Serv1) is not available, because your web.xml is invalid. Double-check your closed tags:

<servlet-mapping>
<servlet-name>Chapter1Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
<servlet-mapping>

Should be:
</servlet-mapping>
 
Madhura Choudhary
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Justin Rundle,

I have made the correction but still i am getting the same error.

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<servlet>
<servlet-name>Chapter1Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>

</web-app>
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does your servlet definitely exist in WEB-INF/class dir? And the servlet class is definitely called Ch1Servlet.class?
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhura: you said your web.xml is in:
C:\Program Files\apache-tomcat-6.0.14\webapps\ch1

It should be in:
C:\Program Files\apache-tomcat-6.0.14\webapps\ch1\WEB-INF\
 
Madhura Choudhary
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Justin Rundle ,

After putting my web.xml inside WEB-INF its working. Really very silly mistake i had made.
Thanks a lot for helping me out
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No probs, but I guess from here on in you'll never forget
 
Madhura Choudhary
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope...Never
 
Ranch Hand
Posts: 65
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i have exactly the same problem. I changed my web.xml also. Now it looks like:


My ch1Servlet class looks like following:


And the class file is in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ch1\WEB-INF\classes\ch1Servlet.class
And web.xml is in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ch1\WEB-INF\web.xml

I get the same error Http Status 404 : The requested resource () is not available.
I checked both the files these seems ok to me.
Can anyone please guide me.
Thanks
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi evryone, i too have the same problem. i have taken into consideration the complete instruction given in the above posts. Then also i m getting Error like this:

HTTP Status 404 -

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

type Status report

message

description The requested resource () is not available.


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

Apache Tomcat/5.5.27


the web.xml file is:
<?xml version="1.0" encoding="ISO-8851-1" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chapter1Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>

and it is stored in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ch1\WEB-INF\

the Ch1Servlet.class file is:

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class Ch1Servlet extends HttpServlet{

public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException{

PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html>"+
"<body>"+
"<h1 align=center>HF\'s Chapter1 Servlet</h1>"
+"<br>"+today+"</body>"+"</html>");

}

}

and it is stored in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ch1\WEB-INF\classes\

please help i have wasted alot of time on it
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first thing I'd try would be to put the servlet in a package. Leaving servlets or anything else in the default package is not recommended. So retry after putting the servlet in a package.

web.xml


Ch1Servlet.java


C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ch1\WEB-INF\classes\servlets\Ch1Servlet.class

http://localhost:8080/ch1/Serv1
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Change the web.xml, put encoding="ISO-8859-1" instead of encoding="ISO-8851-1".Try it out.

Chithra Salam
 
danish mansoor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Chithra. by changing the ISO-encoding in web.xml the way you said my first servlet program started working. but what was the reason behind it ?
Thanks alot once again and sorry for my late reply(because of my faulty internet connection) .
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone,

even i've the same problem.

i'm trying to run a servlet example. i'm getting a blank page after clicking submit button. Please help.

Login.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>SCWCD_Example_1_3</title>
</head>
<body>
<h3>Please enter your userid and password to see your account statement:</
h3>


<form action="LoginServlet" method="POST">
Userid : <input type="text" name="userid">


Password : <input type="password" name="password">


<input type="submit" value="Show Statement">
</form>
</body>
</html>

LoginServlet.java
public class LoginServlet extends HttpServlet {

Hashtable users = new Hashtable();
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
String userid=request.getParameter("userid");
String pword =request.getParameter("password");
if(userid !=null && pword !=null && pword.equals(users.get(userid))){
request.setAttribute("userId", userid);
ServletContext sc= getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/AccountServlet");
rd.forward(request, response);
return;
}else{
RequestDispatcher rd = request.getRequestDispatcher("/login.html");
rd.forward(request, response);
return;
}
}
public void init() throws ServletException{
users.put("user1", "aaa");
users.put("user2", "bbb");
users.put("user3", "ccc");
}
}
web.xml
<servlet>
<description>wcd test project</description>
<display-name>wcd test project</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.example.servlets.LoginServlet</servlet-class>
</servlet>
<servlet>
<description>wcd test project</description>
<display-name>wcd test project</display-name>
<servlet-name>AccountServlet</servlet-name>
<servlet-class>com.example.servlets.AccountServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AccountServlet</servlet-name>
<url-pattern>/AccountServlet</url-pattern>
</servlet-mapping>

AccountServlet.java
public class AccountServlet extends HttpServlet {

Hashtable data = new Hashtable();
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
String userId = (String)request.getAttribute("userid");
if(userId!=null){
String[] records = (String[])data.get(userId);
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println("<h3>Account Status for "+userId+" at the start of prev 3 months");
for(int i=0;i<records.length;i++){
out.println(records[i]+">
");
}
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
}
public void init() throws ServletException {
data.put("ann", new String[]{ "01/01/2002 : 1000.00",
"01/02/2002 : 1300.00", "01/03/2002 : 900.00"} );
data.put("john", new String[]{ "01/01/2002 : 4500.00",
"01/02/2002 : 2100.00", "01/03/2002 : 2600.00"} );
data.put("mark", new String[]{ "01/01/2002 : 7800.00",
"01/02/2002 : 5200.00", "01/03/2002 : 1900.00"} );
}

}
Please note that i've checked all the below mentioned checkpoints:
1- the classes are in WEB-INF/classes/com/example/servlets/*.class
2- the web.xml is in WEB-INF directory.
3-the logs in the tomcat shows no error

please advise where i'm missing something...
 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the above code works fine if i replace the servlet name with some jsp (directly under the webroot), the requestdispatcher is working fine.
it doesn't work for servlets alone. is there something i'm missing wrt RequestDispatcher methods ?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chithra Salam wrote:Hi,

Change the web.xml, put encoding="ISO-8859-1" instead of encoding="ISO-8851-1".Try it out.

Chithra Salam



I was having this same problem described in this thread and could not get the Ch1Servlet to run on my Windows Vista laptop with Tomcat 6.0.18.
This change worked (in web.xml making the encoding="ISO-8859-1" instead of encoding="ISO-8851-1") and the Ch1Servlet runs.

Why did this fix the problem? How would I troubleshoot this? Which Tomcat log file would have info as to why the deployment failed?

Why not just always use "UTF-8" as the encoding? That seems to be the most standard and inclusive encoding so why even bother with anything else?

The Tomcat admin simply said "FAIL - Application at context path /ch1 could not be started", not much help to troubleshoot the problem.

Thanks for helping a newbie out



 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a common mistake. As I understand it ISO-8851-1 is not a valid encoding as it references the ISO standard for the "Determination of moisture, non-fat solids and fat contents for Butter". Consequently, Tomcat chokes attempting to read the URI encoding declared in your web.xml. As for the UTF-8 question, it's really just a matter of the fact the the Tomcat standard defaults to ISO-8859-1 and utilizing UTF-8 requires a minor change to the Connector configuration in your server.xml.

Hope this helps.
 
Greenhorn
Posts: 12
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

The recent replies are correct.
Changing the encoding scheme from "ISO-8851-1" to "ISO-8859-1" works.
I believe its a typo in the Head First Servlets and JSP book. Its present in the second edition.

As someone rightly referred, "ISO-8851-1" specifies the routine method for the determination of the moisture content of butter. Wonder how that's related to us in the Java fraternity.

And Johnson, one could also debug this error easily by having a look at the log files at
CATALINA_HOME\logs\catalina.YYYY-MM-DD

One gets an error like below :-


Regards,
Darshan Shroff
shroffdarshan@gmail.com
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chithra Salam wrote:Hi,

Change the web.xml, put encoding="ISO-8859-1" instead of encoding="ISO-8851-1".Try it out.

Chithra Salam



It fixed this issue for me... Thanks a lot but I would like to now the root cause.

Regards
Vinay Noah
 
Greenhorn
Posts: 1
VI Editor Slackware Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Redundant reply, but still: changing the encoding from ISO-8851-1 to ISO-8859-1 did the trick.



Depressing error in the book.



-zsejk

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic