Results 1 to 3 of 3
  1. #1
    mazem is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Default Class not found exception for the servlet class.

    I have created a servlet class with do get method in it.When am trying to run it on the tomcat server, it says class not found exception.Below is the servlet configuration in web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>SimpleProject</display-name>
    <servlet>
    <description>Servlet uses Get </description>
    <display-name>ServletName</display-name>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>MyPackg.Serv.SimpleServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ServletName</servlet-name>
    <url-pattern>/SimpleServletPath</url-pattern>
    </servlet-mapping>
    </web-app>.
    When am trying to hit the URL http://localhost:8080/SimpleProject/SimpleServletPath, it says MyPackg.Serv.SimpleServlet is not found. Can some one help me with this issue.
    It is able to recognize the application simpleproject but when i access simpleservletpath it throws the class not found error.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    It seems all your web.xml mappings name the servlet 'ServletName'...try renaming it in your web.xml, or accessing the servlet with this name.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default

    The important part for the URL used is this bit:
    <url-pattern>/SimpleServletPath</url-pattern>

    So the URL xxx/SimpleProject/SimpleServletPath should bring up the servlet.

    Where is your servlet class file located under WEB-INF?

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2011, 10:34 AM
  2. Class not found Exception
    By surendra in forum Java Servlet
    Replies: 8
    Last Post: 06-09-2011, 12:52 PM
  3. Replies: 1
    Last Post: 01-03-2010, 09:48 PM
  4. class not found exception while using IKVM to create exe for c#
    By manjunath k reddy in forum New To Java
    Replies: 0
    Last Post: 02-21-2009, 06:05 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •