I think the problem is in <servlet-mapping> of your web.xml. Just comment it
out, it should work.

tom

-----Original Message-----
From: krishna prasad [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 7:06 PM
To: [EMAIL PROTECTED]
Subject: unable to run some servlets

hi everyone,

  I'm having trouble running servlets which are in a directory i created.

Details:

   System: Win95
   Tomcat Version: 4.0

Problem:

     I created a new directory in called "kp"
"install_dir/webapps" folder. I also created WEB-INF and classes dirctories
(install_dir/webapps/kp/WEB-INF/classes).
I wrote a small servlet program and kept the .class file in classes folder. 
I also wrote the xml file and kept it in WEB-INF folder.

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_2.dtd";>


<web-app>

  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>HelloWorldServlet</servlet-class>
  </servlet>

  <servlet-mapping>
      <servlet-name>hello</servlet-name>
        <url-pattern>/hello</url-pattern>
  </servlet-mapping>

</web-app>

end of xml file---------------------------


when i'm trying to access from browser like this

http://localhost/kp/hello OR
http://localhost/kp/HelloWorldServlet

the browser is displaying the file not found page.
(i changed the port no. to 80 in server.xml file)
(i also inserted <DefaultContext reloadable="true"/> in server.xml)

What am i missing here? And wat really beats me is i downloaded a bookstore 
example from java.sun.com in
.war format. When i placed it in the reqd folder the folders WEB-INF, 
classes etc were automatically created

(install_dir/webapps/bookstore/WEB-INF/classes)

and it is working fine. Now I tried moving my HelloWorldServlet.class file 
into classes folder of bookstore and made necessay changes to xml file of 
bookstore in

install_dir/webapps/bookstore/WEB-INF/web.xml

and i'm able to run the helloworld servlet using
http://localhost/bookstore/hello

I'm also able to run the servlet when i put the class file in 
install_dir/webapps/ROOT/WEB-INF/classes
and using http://localhost/servlet/hello.

Why am i not able to run when the file are in the folder i created. Kindly 
help me with this problem.
If this prob has been addressed before kindly provide pointers

Thank you

kp

















_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to