| | |
First Servlet
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 1
Reputation:
Solved Threads: 0
Hey Guys.....I am new in web development and this was supposed to be my first Servlet but I am getting
java.lang.ClassNotFoundException: servlets.HelloWorldServlet
Now in my Apache tomcat folder C:\apache-tomcat-6.0.16\webapps\ServletExamples I have the WEB-INF folder.....which has the web.xml....
Web.xml is something like this...
The HelloWorldServlet.java is
and this is what I am writing on the url......
http://localhost:8080/ServletExamples/HelloWorldServlet
and I am assuming that the problem is coming in the <servlet-class> in the fully qualified name....
So I decided to make a classes folder in the WEB-INF folder and copy all my .class files and .java files in it.....
after this I am still getting the same error....
java.lang.ClassNotFoundException: servlets.HelloWorldServlet
and when I refresh it again it gives me a different error....which is
So how can anybody help me out in starting my carrier in the servlets...
Thanks in advance
Regards
ISI
java.lang.ClassNotFoundException: servlets.HelloWorldServlet
Now in my Apache tomcat folder C:\apache-tomcat-6.0.16\webapps\ServletExamples I have the WEB-INF folder.....which has the web.xml....
Web.xml is something like this...
JSP Syntax (Toggle Plain Text)
<?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>HelloWorldServlet</servlet-name> <servlet-class>servlets.HelloWorldServlet</servlet-class> </servlet> <servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>servlets.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorldServlet</servlet-name> <url-pattern>/HelloWorldServlet</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/LoginServlet</url-pattern> </servlet-mapping> </web-app>
The HelloWorldServlet.java is
JSP Syntax (Toggle Plain Text)
package servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class HelloWorldServlet extends HttpServlet{ public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ PrintWriter pw = response.getWriter(); pw.println("<html>"); pw.println("<head>"); pw.println("</head>"); pw.println("<body>"); pw.println("<h3>Hello World as a Servlet</h3>"); pw.println("</body>"); pw.println("</html>"); } }
and this is what I am writing on the url......
http://localhost:8080/ServletExamples/HelloWorldServlet
and I am assuming that the problem is coming in the <servlet-class> in the fully qualified name....
So I decided to make a classes folder in the WEB-INF folder and copy all my .class files and .java files in it.....
after this I am still getting the same error....
java.lang.ClassNotFoundException: servlets.HelloWorldServlet
and when I refresh it again it gives me a different error....which is
•
•
•
•
type Status report
message Servlet HelloWorldServlet is not available
description The requested resource (Servlet HelloWorldServlet is not available) is not available.
Thanks in advance
Regards
ISI
![]() |
Other Threads in the JSP Forum
- Previous Thread: Retrieve unique items
- Next Thread: how to get the running applications in windows task manager using java
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web





