Servlet class path

Can anybody tell me what is the exact path to put the servlet class file in
tomcat 4. I was reading a book called more servelet by Marty Hall and its metioned there that i can put them in install_dir/webapps/ROOT/WEB-INF/classes but when i browse to WEB-INF folder there is no folder named classes there.
Please help.

firsly i installed jdk 1.3 on my computer. Then i installed tomcat 4. Then i changed port 8080 in server.xml to 80. Then i set the JAVA_HOME path to point to jdk1.3 folder. Then i setup the class path to D:\Documents and Settings\Ashi\Desktop\tomcat\apache-tomcat-4.1.34\apache-tomcat-4.1.34\common\lib\servlet.jar
Then i downloaded a source file named HelloServlet.java from author's website and compiled it. It compiled successfully. I copied the HelloServlet.class file to the classes directory that you asked me to create. Then i opened my browser and typed http://localhost/servlet/HelloServlet and getting error HTTP Status 404

Similar Messages

  • How can I find the real path to servlet class

    Hi,
    I am facing an issue. Am in the process of creating a filter which would send a Last-modified along with the header. For this I will be checking the is-modified-since
    header and lastModified date of the file.
    The problem I am facing is that after taking the file part from the request and checking
    the lastmodified date, it gives error. This is because i use,
    String real_path = getServletContext().getRealPath(request.getServletPath());
    and it would return the path to servlet-name and not to servlet-class, since servlet-name
    is not physically present. It would return an error value.
    Is there any way which I could find the real path to my servlet class file ?

    Remember you should not take the last mnodified date
    of the class file or the jar file that contain the
    class as the value for the getLastModified method
    becouse the last modified date that should be used in
    the caching is the last modified date of the dynamic
    content that the servlet is about to prodice.
    The same class file will produce different content
    for different requests if not why do you use
    servlets you can directly use the static contentThanks for a valuable remark.
    Hence our getLastModified() often returns System.currentTimeMillis() result.

  • How to set class path for mysql

    hai, I have been trying to make a java program read from mysql database. but i don't know how to set the class path for mysql-connector-java-5_1_.0.6-bin. i set the class path in system variable as C:\Program Files\Java\jdk1.5.0_08\jre\lib\ext\mysql-connector-java-5_1_.0.6-bin.
    in the command prompt, i compile C:\javac abc.java and run java abc.
    when run it come out error java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    i am using Window xp. can anybody help me??? TQ.

    hai, I have been trying to make a java program read
    from mysql database. but i don't know how to set the
    class path for mysql-connector-java-5_1_.0.6-bin. i
    set the class path in system variable as C:\Program
    Files\Java\jdk1.5.0_08\jre\lib\ext\mysql-connector-jav
    a-5_1_.0.6-bin.
    in the command prompt, i compile C:\javac abc.java
    and run java abc.
    when run it come out error
    java.lang.ClassNotFoundException:
    com.mysql.jdbc.Driver
    i am using Window xp. can anybody help me??? TQ.Right click on my computer icon,
    Goto properties->advanced->environment variables.
    Look for 'classpath' under system variable.
    Select it and click edit.
    put ';' and path of the mysql connector jar at the end
    suppose if u have jar file under d:/driver/mysqlconnector.jar
    thn put this value in variable value text box
    ;d:/driver/mysqlconnector.jar
    or simply put ur driver jar file in jre/lib/ext folder
    D:\j2sdk1.4.2_03\jre\lib\ext
    [Servlet tutorial|http://www.jsptube.com]

  • Domain/lib class path issues

    Hello,
    We are migrating one of our applications from Web Logic 8.1 to 10. The new instance is going to have 2 managed servers, under the web logic domain, hosting the server EAR as well as web WAR respectively. Now the application has certain jars that need to be available for the startup classes in both these modules. As Web Logic provides a feature to place the jars in the domain/lib so they are visible to both the applications, we have included the jars in the domain/lib directory. However, when the startup class loads, it is not able to access any of the classes that are part of the jars in the domain/lib folder! Instead, we are presented with a NoClassDefinitionFound error!!
    I am writing to see if any one has any insight on what could be causing this and if this is doable in the first place!
    Thanks,
    SG

    You are facing the problem of classloaders.
    What is inside the ejb classloader, cannot be accessed by a sibling classloader or a parent classloader.
    Thus, u need to package the home and remote interfaces inside the WAR.
    As regards the utilities used by ejb and servlets, place them at a common location: the servers classpath. Again, exercise some caution. If u place the utility classes in server's class path, then the ejb and servlets can access theese utility classes, but the utility classes cannot access the servlets/ejb classes (ie, utility will be in parent class loader and it cannot access the classes in its child classloaders)

  • How to publish a servlet class to web server?

    background:
    web server: tomcat apache 4
    context path: webapp\test\
    servlet path: webapp\test\WEB-INF
    servlet name: HelloWorld.class
    i tried to placed the servlet class file to above servlet path,
    but i can't invoke the servlet by http://localhost:8080/test/HelloWorld
    what should i do in order to invoke the servlet at browser?
    Is a web.xml necessary a must to provided a mapping between request name and actual class name?

    First of all you need a *.war structure which look like this
    /app-name
    /app-name/WEB-INF/
    /app-name/WEB-INF/lib
    /app-name/WEB-INF/classes
    When you have created this structure you add your servlet (HelloWorld.class) in the classes directory (Create the package structure first).
    When this is done you need to map the servlet to a given uri which is done in the web.xml. An example is found below:
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>package.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello/*</url-pattern>
    </servlet-mapping>
    Hopefully this will help :-)
    best regards
    Stig

  • Problem in compiling servlet class - using Tomcat

    Hi,
    I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
    and my deployment descriptor in D:\servlet_wrk\project1\etc
    my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
    and
    my PATH var is set to C:\Sun\AppServer\bin.
    When I compile my servlet class Ch1Servlet.java in the command line from the directory
    D:\servlet_wrk\project1 using the command
    javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
    it says error:cannot read: src/Ch1Servlet.java
    Can somebody help me to solve this problem and help me to compile my servlet class.
    Thanks.

    Thanks...as u said I tried putting dir & found that
    my file was saved as Ch1Servlet.java.txt instead for
    Ch1Servlet.java......So that was a problem.Now I'm
    able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
    But on compiling I'm getting the following error
    package java.servlet.* does not exist
    package java.servlet.http.* does not exist
    package java.io.* does not exist
    Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

  • Applet with class path Problem

    Hi all,
    I am facing a strange problem: I wrote an applet and sign it tomake it able to access some client resources, my applet is intended to play audio mp3 files, so I need some libs like jmf.jar, if my libs do not exist I recieve them from my web app via URLConnection to servlet.
    after libs download completing, I can not instantiate any of libs class because my libs do not exist in the class-path.
    I need any suggestion. what can I do?
    1 - change the class path - during run time - to point to the current libs location.
    or
    2 - load the jar libs manually - during run time - and instantiate my classes.
    or what?
    please include examples.
    Thanks
    Ahmad Elsafty

    PATH and CLASSPATH are different. PATH is an environment variable used by windows to locate programs. CLASSPATH is an environment variable that java uses to find classes.
    You need to create a new environment variable. The easiest way to do it in win2k (and to keep it after you reboot) is to do this: right click on "My Computer" and click "Properties" (or go to "System" in the control panel). Click on the "Advanced" tab. Click the "Enviroment Variables..." button. In that window, add a system variable by clicking "New..." in the bottom half. Variable Name: "CLASSPATH" Variable Value: ".;J:\Skribe\Tools\mysql-connector-java-3.0.0-beta\mysql-connector-java-3.0.0-beta-bin.jar;J:\jakarta-log4j-1.2.6\dist\lib\log4j-1.2.6.jar"
    You have to make sure that ".;" is the first thing on the line. This tells java to look in the current active directory first for classes it doesn't recognize, then in locations you specify. By default, it just looks in the current directory.
    Hope this helps.

  • How to access an external text file in a Servlet class?

    I do the regular file I/O in the Servlet class. But when I run Servlet class, text file is not loaded. Can sb tell me how to do it?
    Thanx
    Richard

    Hi DrClap;
    the following is the main servlet code, which calls other two classes.
    ===================================================================
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class TermsServlet extends HttpServlet {
              public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
              resp.setContentType("text/html");
              PrintWriter out = resp.getWriter();
              out.println("<HTML>");
              out.println("<TITLE>Computer Terms and Acronyms</TITLE>");
              out.println("<BODY>");
              out.println("<H1>Computer Terms and Acronyms</H1>");
              out.println("<TABLE BORDER=2>");
              out.println("<TR><TH>Term<TH>Meaning</TR>");
              TermsAccessor tax = new TermsAccessor("terms.txt");
              Iterator e = tax.iterator();
              while (e.hasNext()) {
                   Term t = (Term)e.next();
                   out.print("<TR><TD>");
                   out.print(t.term);
                   out.print("<TD>");
                   out.print(t.definition);
                   out.println("</TR>");
              out.println("</TABLE>");
              out.println("<HR></HR>");
              out.println("</BODY></HTML>");
    =================================================
    import java.io.*;
    import java.util.*;
    public class TermsAccessor {
         protected BufferedReader is;
         protected String ident;
         public TermsAccessor(String inputFileName) throws IOException {
              is = new BufferedReader(new FileReader(inputFileName));
              String ident = is.readLine();
         public String getIdent() {
              return ident;
         public Iterator iterator() {
         return new Iterator() {
              String line, term, defn;
    public boolean hasNext() {
              try {
              return ((line = is.readLine()) != null);
              } catch (IOException e) {
              System.err.println("IO Error: " + e);
              return false;
              public Object next() {
              int i;
              while ((i = line.indexOf("\t"))<0 && hasNext());
              if (line == null)
              throw new IllegalStateException("Invalid EOF state");
                        term = line.substring(0, i);
                        defn = line.substring(i+1);
                        return new Term(term, defn);
              public void remove() {
              throw new UnsupportedOperationException();
    =============================================================
    public class Term {
              public String term;
              public String definition;
              public Term(String t, String d) {
              term = t;
              definition = d;
    =================================================================
    part of [terms.txt] file as following:
    $Id: terms.txt,v 1.5 2000/03/17 04:08:55 $
    AMD     American Micro Devices: a chip maker that competes with Intel.
    API     Application Programmer Interface: a set of functions that a programmer can use
    ASP     Active Server Pages, a Microsoft technology for imbedding certain commands in HTML pages
    BSD     Berkeley Software Distribution, one of the two major flavors of UNIX. See OpenBSD
    C     A computer programming language invented for writing UNIX in, and very popular in the late 1970's through the 1990's
    C++     An Object-Oriented language heavily based on C; recently displaced by Java
    CGI     Common Gateway Interface; a script or program used to handle a form on a web page
    COBOL     COmmon Business Oriented Language, a programming language used mainly for large-scale financial applications.
    CPU     Central Processing Unit, the "chip" that gives a computer its low-level personality ("machine instruction set") and performs individual instructions (add, multiply, compare...). Common CPUs include Intel/AMD "PC", SPARC, Alpha.
    =================================================================
    the "terms.txt" file and above class files are under the same directory. I use J2EE server to deploy the file, after run, the erro mesage is:"The requested resource (terms.txt (The system cannot find the file specified)) is not available." That means server can not locate the terms.txt file. So what file path should I use?
    Thanx
    Richard

  • Problems importing servlet classes

    When I try to compile a bean which has import statements for importing servlet classes, I get the message that the class is not found in import when I compile the code. I have all these class files and I'm not sure whether I've placed them aptly. Please give me the details about placing the servlet classes and configuring my javac to import these classes.
    Thanks!

    If you place your classes in the %JAVA_HOME%/jre/lib/ext, they will be automatically accepted by the javac and the java. But, depending on the classes you use, it would be better to include them in %application path%/WEB-INF/lib, so they will only be used by that application.

  • How can I find the servlet class name from inside a ServletFilter?

    Ive implemented a servlet filter, but need to discover the class name of any servlet class that gets executed.
    Ive dug through the spec and cant seem to find any path to do this.
    Seems the methods needed to do this have been deprecated. (for security reasons?)
    Is there any way to write a ServletFilter to grab this info?
    If not, is there any other way to capture every servlet execution in the container, time its execution, and log the class name along with the execution time?
    (***WITHOUT*** requiring a classpath over ride of any container provider classes)
    Any help is much appreciated. Been banging my head against this for some time now :(

    request.getServletPath() returns the part of the URL which refers to the servlet. It isn't the classname of the servlet but it should be a reasonable surrogate. If you log that, then you could write some code which reads your web.xml and uses the servlet-mapping elements to convert it to servlet class names later.

  • Compiling servlet class:javac gives 'bad command'

    I have a servlet class in the path: E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    I am using Tomcat 3.2.4 and Just Go (the tomcat launcher) provides this log of my settings:
    CLASSPATH:
    .;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    Executable :
    E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    Command line arguments (in order appended) :
    -Dtomcat.home=E:\Tomcat324\jakarta-tomcat-3.2.4
    org.apache.tomcat.startup.Tomcat
    Environment Vars :
    TOMCAT_HOME=E:\Tomcat324\jakarta-tomcat-3.2.4
    TOMCAT_LIB=E:\Tomcat324\jakarta-tomcat-3.2.4\lib
    JAVA_HOME=E:\JBuilder35\jdk1.2.2\jre
    JAVA_EXE=E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    WINDIR=C:\WINDOWS
    CLASSPATH=.;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    In my DOS screen, I go to the path E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes and type in "javac helloWorld.java" and I get the message :Bad Command or File Name
    I'd greatly appreciate it if anyone could tell me what path to use in DOS to enable me to use the javac command.
    My problem is there are so many paths in the Tomcat settings (above), I am not sure which one to use to compile my servlet.

    Thanks for the suggestion. I am not trying to use JBuilder, just the command line from DOS so I hope that won't impact this.
    JAVAC is in e:\jbuilder35\jdk1.2.2\bin
    and the class that I am trying to run is in:
    e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    and it's called CookieExample.java
    Here's a copy of my DOS Screen of what I did and the result:
    E:\>set path = javac e:\jbuilder35\jdk1.2.2\bin;%path%
    E:\>cd e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes>javac CookieE
    xample.java
    Bad command or file name
    -Any idea why I am still getting the error?

  • Getting servlet class corresponding to jsp?

    Hi,
              I'm running WebLogic 5.1, sp12 for Solaris. I was wondering if
              someone could provide me with a small snippet of java code that would
              tell me the class name, or at least path to the servlet class that
              corresponds to a jsp page. So, for example, if I knew my jsp path was
              /mypath/http/myapp/dummy.jsp
              it would be great to get the class name which, in this example, might
              be:
              jsp_servlet._myapp.__dummy
              Thanks in advance, Dave A.
              

    Programmatically, I don't know of a way to do that in java.
              Bill
              "D. Alvarado" wrote:
              > Thanks for your reply, What if you wanted to get the classname of a
              > particular jsp from another jsp? For example, what if I wanted to
              > know the class name of "/mypath/http/myapp/dummy.jsp" if I'm writing
              > code in "mypath/http/myapp/another.jsp"?
              >
              > Thanks, Dave
              >
              > William Kemp <[email protected]> wrote in message news:<[email protected]>...
              > > this.getClass().getName() will give you the name of the class at runtime.
              > >
              > > Bill
              > >
              > > "D. Alvarado" wrote:
              > >
              > > > Hi,
              > > > I'm running WebLogic 5.1, sp12 for Solaris. I was wondering if
              > > > someone could provide me with a small snippet of java code that would
              > > > tell me the class name, or at least path to the servlet class that
              > > > corresponds to a jsp page. So, for example, if I knew my jsp path was
              > > >
              > > > /mypath/http/myapp/dummy.jsp
              > > >
              > > > it would be great to get the class name which, in this example, might
              > > > be:
              > > >
              > > > jsp_servlet._myapp.__dummy
              > > >
              > > > Thanks in advance, Dave A.
              

  • Problem for retriveing servlet class file (error in DD) I think so

    hi to all ,
    my deployment descriptor is here ....
    I tried to access servlet ... I got the response is like that
    The requested Resource is not available
    why its happening ?
    <?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>
    <welcome-file-list>
         <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <listener>
         <listener-class>CallMonitor.MyListener</listener-class>
    </listener>
    <servlet>
         <servlet-name>LoginAction</servlet-name>
         <servlet-class>LoginAction</servlet-class>
    </servlet>
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>LoginAction</servlet-name>
         <url-pattern>/LoginAction</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    <context-param>
         <param-name>jdbcurl</param-name>
         <param-value>jdbc:mysql://localhost:3306/test</param-value>
    </context-param>
    </web-app>But i remove the code from it , i can access LoginAction Servlet..
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    In Tomcat manager i found the applicaton is not running.
    i started the application using start command...
    But i got error message
    FAIL - Application at context path /25.7 could not be started
    Message was edited by:
    kannankalli

    <servlet-class>InsertData</servelt-class>Closing element for <servlet-class> is wrong.
    Before posting for any help check following stuff
    - Whether deployment descriptor is well-formed
    - Whether it is valid i.e. all elements are properly placed

  • Servlet Class dependency is not found at weblogic startup.

    I have the following ear file which includes:
    web-inf\lib (contains all the needed utilities jar)
    *ejb.jar
    *webapp.war (The WEB-INF\lib dir inside war file contains all the needed utilities
    jars.
    I get the following BEA-101250 error saying that a servlet could not be loaded
    because a class that it depends on is not in the classpath. But I think I place
    all the needed jars in the startWebLogic.cmd file as well as in the WEB-INF\lib
    of the ear and war files. However, if a classs that a servlet depends on is not
    found, why doesn't weblogic simply tells us what that class is (instead of guessing
    to death)? How can I find which class that the servlet depends on is not found?
    Thanks.
    BEA-101250
    Error: [context]: Servlet class className for servlet svltName could not be loaded
    because a class on which it depends was not found in the classpath classPath.\nt.
    Description
    [context]: Servlet class className for servlet svltName could not be loaded because
    a class on which it depends was not found in the classpath classPath.\nt.
    Cause
    One of the classes the servlet class uses was not recognized by the Web application
    classloader.
    Action
    Make sure the class is available either in WEB-INF/classes or WEB-INF/lib or
    system classpath.

    Hmm, do you perhaps have the prefer web-inf-classes set in weblogic.xml?
    -- Rob
    rock wrote:
    I place all the utilties class in the top level APP-INF/lib. Same error. I installed
    this application on JBoss and everything runs fine. I really don't know what
    classes or jar that weblogic says that a servlet depends on.
    There are only a finite number of places where you can put all the needed jars
    in which that servlet depends:
    1. myapp.ear/APP-INF/lib
    2. myapp.ear/WEB-INF/lib
    3. or put it to a directory in the ear and refer to each jars in the CLASS-PATH
    line of the MANIFEST.MF file.
    4. myweb.war/WEB-INF/lib
    5. EJBs are in myapp.ear top directory
    6. Refer to all the jars in startWebLogic.cmd script as it starts.
    I still don't know what jars I am missing.
    Thanks.
    Rob Woollen <[email protected]> wrote:
    rock wrote:
    Rob,
    I remove all the classpath, but when I deploy the ejb complains thatit missed
    all the needed utilities class. Ok, stop there. If the utilities classes need to be seen by both the
    EJBs and webapp, then placing them in WEB-INF/lib is not enough. That
    makes them available only to the webapp.
    If you're using 8.1, then the solution is pretty simple. Move your
    utility classes into a top-level directory named APP-INF/lib
    ie
    ear/APP-INF/lib/utils.jar
    ear/fooejb.jar
    ear/fooweb.war
    If you're using < 8.1, then you can still move the jars to APP-INF/lib,
    but you'll need to add manifest class-path entries to the EJB and webapp.
    -- Rob
    I again place it on - the ear deploys fine (ejbs
    and war). But the starting servlet could not loaded because it cannotfinds a
    class that it depends on. I think I reference all the classes or jarsthat it
    needs - so I need it to tell me which one. I don't know why weblogicmakes it
    so difficult. It took me a month already and all I need to do is findthe class
    that it complains about.
    Rob Woollen <[email protected]> wrote:
    Yes, it would be nicer if that exception had more information.
    You told the web container the servlet-class in your web.xml. THe
    web
    container tried to load it and got a NoClassDefFoundError.
    Unfortuantely that exception doesn't include much information.
    NoClassDefFoundErrors are caused by something in a parent loader
    depending on something in a child classloader.
    Step #1 is for you to remove everything you've added to the $CLASSPATH.
    If that doesn't solve your problem, post again.
    -- Rob
    rock wrote:
    I have the following ear file which includes:
    web-inf\lib (contains all the needed utilities jar)
    *ejb.jar
    *webapp.war (The WEB-INF\lib dir inside war file contains all the
    needed
    utilities
    jars.
    I get the following BEA-101250 error saying that a servlet could notbe loaded
    because a class that it depends on is not in the classpath. But Ithink I place
    all the needed jars in the startWebLogic.cmd file as well as in theWEB-INF\lib
    of the ear and war files. However, if a classs that a servlet dependson is not
    found, why doesn't weblogic simply tells us what that class is (insteadof guessing
    to death)? How can I find which class that the servlet depends onis not found?
    Thanks.
    BEA-101250
    Error: [context]: Servlet class className for servlet svltName couldnot be loaded
    because a class on which it depends was not found in the classpathclassPath.\nt.
    Description
    [context]: Servlet class className for servlet svltName could notbe loaded because
    a class on which it depends was not found in the classpath classPath.\nt.
    Cause
    One of the classes the servlet class uses was not recognized by theWeb application
    classloader.
    Action
    Make sure the class is available either in WEB-INF/classes or WEB-INF/libor
    system classpath.

  • How to set the servlet context path manually in Tomcat web server.

    I tested some servlets by putting them in the folder , which the tomcats examples application uses (ie Tomcat 4.1\webapps\examples\WEB-INF\classes\) and it appeared to be working fine.
    I was calling the servlet like this : http://localhost:2006/examples/servlet/TestServlet
    But when I installed my own WAR file in the server , the servlet is not working now. now the new location of my servlets is : Tomcat 4.1\webapps\MyApp\WEB-INF\classes\
    and I'm trying to call the servlet like this : http://localhost:2006/MyApp/servlet/TestServlet
    The error , what i'm getting is :
    description :The requested resource (/MyApp/servlet/TestServlet) is not available.
    Some body please tell where I'm making the mistake ? I believe this may have something to do with the servlet context path setting. If anybody has any idea , how to set the path..will be much appreciated.

    Thanx for your reply , at first I was not using any web.xml(since not mandatory) but even after using the web.xml file the error is coming . Please have a look into the contents of the web.xml file and let me know if you find any problem...
    <?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>TestServlet</servlet-name>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    </web-app>
    one more thing I would like to tell you here. I was just looking into the configuration of Iplanet web server..I found that , there are options to set the servlet container path (like : - Prefix: /servlet
    Servlet Directory: /ecomm/iplanet/nes60/product/docs/container )
    so from here I came to know that "container " is the folder where we should put our servlets and it has URI as "servlet" but yet I'm not able to find any option in the Tomcat Web server to set the servlet container to any different directory.
    If you have any idea please let me know.

Maybe you are looking for