• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

HTTP 404 Error  RSS feed

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have the following web.xml file:
<?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>app1</servlet-name>
<servlet-class>MyApp1</servlet-class>
<init-param>
<param-name>username1</param-name>
<param-value>muratb</param-value>
</init-param>
<init-param>
<param-name>password1</param-name>
<param-value>muratb</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>testcm</servlet-name>
<servlet-class>QuestionAsk</servlet-class>
</servlet>
</web-app>

This application resides in /test directory under webapps.
When I call the first servlet with localhost/test/servlet/app1 it displays fine but localhost/test/servlet/testcm give HTTP Not Found error although it is declared in the web.xml file.
(I restarted the Tomcat Service)

What I am doing wrong?
Thank you
Murat
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try adding

to your web.xml and restart Tomcat.
 
Murat Balkan
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried it but didnt work. Both servletmapping and general convention (/context/servlet/servletname) does not work. First entry in the web xml file can be called but the second one returns an error 404.(first http 500 in the seconf refresh 404)
Http 500 root cause is
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class app1 with modifiers ""
I think the problem is with app1 servlet. If so, whats the problem with the following servlet?
Heres the code of app1:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
class app1 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{

PrintWriter pw=res.getWriter();
pw.print("hello");
}
}

Thanks
Murat
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


class app1 extends HttpServlet


It's not a public class.
 
Murat Balkan
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.I missed it. It works now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!