i am using Tomcat 4.1 i am able to run HTML and JSP from browser. But i am unable to run the servlet........ i kept the HelloServlet.class in the Tomcat\webapps\ROOT\WEB-INF\classes. and http://localhost:8080/servlet/HelloServlet is not working.Actually there was no classes directory in WEB-INF i created it and kept the class file in it. is that it wont work with higher versions of Tomcat ? then what i have to do......
thanku for the response i kept your web.xml in WEB-INF directory but already a web.xml file is there in it anyhow i kept both the xml files but still i am getting the 404 error
I think you can do one of two things. 1. Use servlet mapping in the web.xml of your web application like JiaPei Jen began explaining. 2. In tomcat's web.xml under the /conf directory. You can uncomment the mapping for invoker servlet and then it should work like were hoping in your first posting with http://localhost:8080/servlet/HelloServlet. Here is a link where they addressed the same problem, and the explanation is in more capable hands than mine. https://coderanch.com/t/82236/Tomcat/requested-resource-not-availabe
once again thank u for ur response.Both the things didnot work.... 1)i made the web.xml as follows in WEB-INF directory <?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> <display-name>Welcome to Tomcat</display-name> <description> Welcome to Tomcat </description> - <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>HelloServlet</servlet-class> </servlet> - <servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/servlet/HelloServlet</url-pattern> </servlet-mapping> </web-app> but still my servlet is not working . 2) i removed the comments for the invoker servlet in tomcat's web.xml under conf directory but still it ia not working 3) and the link u gave is very complex to understand .please help me in solving the problem
take those '-' out of your web.xml file. IE will add little plus and minus signs to XML files when it displays in a browser. If you copy and paste directly, you get the - and + symbols. It's not good to have them. [ March 03, 2003: Message edited by: Mike Curwen ]
hi, i had encountered same problem with 4.1 vers. then i changed location from the one to <HOME>/ webapps/examples/WEB-INF/classes for testing purpose & it worked fine. then u need to configure server.xml,web.xml to make ur own pckgs. dont forget to change context path.type in brw. http://www.xxx.:<port pt>/examples/servlet/urfile.class
raghu tv, Take another look at the aforementioned thread. I just posted the exact steps I used to resolve this issue on my installation of Tomcat 4.1. Oh, and... Welcome to JavaRanch, raghu tv! We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. Thanks Pardner! Hope to see you 'round the Ranch!