Servlet not found, Tomcat 4.1

This problem is a common one, I know, but I've tried everything to get it to work and it hasn't. The problem is that Tomcat can't find a servlet I've made when I ask for it via an HTML form or even through a direct request in my browser. No matter what, I get "The requested resource is not available", though if I place my servlet in the examples\WEB-INF\classes directory, it works fine.
I have this folder structure:
webapps
--onjava
----WEB-INF
------classes
------lib
JSP files are in \onjava, the compiled servlet (login.class) is in \onjava\WEB-INF\classes.
I've added the following to my server.xml file:
<Context path="/onjava" docBase="onjava" debug="0" reloadable="true"/>
My web.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/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>login</servlet-class>
</servlet>
</web-app>
I should be able to access my servlet directly by using the URL:
http://serv2.ischool.washington.edu:8080/onjava/servlet/login
correct? Yeah, that's what I thought too. But no.
I'd give you my servlet code too, but I don't think it will help...it's not in any packages, it's just a standard servlet. I'm trying to do the tutorial at http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html?page=1 , if you need extra info.
Any help would be greatly appreciated!
Thanks,
Matt

Put this in web.xml and you should be fine
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/servlet/login</url-pattern>
</servlet-mapping>

Similar Messages

  • Servlet not found(404) in linux

    i have java1.4,tomcat3.3.1 and apache2. i want to connect tomat and apache using mod_jk in debian Linux. when i create a Test apllication in webapps called "TestApplication" with a class TestServlet.class.(this is just a Servlet class to print Hello Servlet)
    when i request
    http://localhost:8080/TestApplication/servlet/TestServlet
    http://localhost:8080/TestApplication/servlet/TestServlet
    i am getting servlet not found 404.
    and also in the tomcat i am getting the following messages
    -Ctx(/TestApplication)Class NotFound:TestServlet
    -Ctx(/TestApplication)Status Code:404 request(TestApplication+/servlet+null) msg: null
    JAVA_HOME=/opt/java
    PATH=/opt/java/bin
    TOMCAT_HOME=/opt/tomcat
    and this is my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <servlet>
    <servlet-name>Servlet_TestServlet</servlet-name>
    <display-name>Servlet TestServlet</display-name>
    <description>Default configuration created for Servlet.</description>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    <servlet-name>Servlet_TestServlet</servlet-name>
    <url-pattern>/servlet/TestServlet</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    </web-app>
    and this is my mod_jk.conf file
    <IfModule !mod_jk.c>
    LoadModule jk_module /usr/lib/apache/1.3/mod_jk.so
    </IfModule>
    JkWorkersFile "/opt/tomcat/conf/jk/workers.properties"
    JkLogFile "/opt/tomcat/logs/mod_jk.log"
    JkLogLevel emerg
    JkMount /admin ajp13
    JkMount /admin/* ajp13
    JkMount /examples ajp13
    JkMount /examples/* ajp13
    JkMount /TestApplication ajp13
    JkMount /TestApplication/* ajp13
    when i run tomcat it is showing this application as mounted.
    i think i made everythig fine but i am getting not found 404 message.
    can any one help me..

    Servlets belong to the web-inf/classes dir.
    In web-inf a web.xml file should be saved:
    <?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-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    </web-app>Andreas

  • In WAS Form Based Authentication : Exception Servlet Not Found: FormLoginSe

    Hi,
    I am using form bases athentivation in WebSpahe Application Server.
    When I am send the login.jsp then this exception is comming
    com.ibm.ws.webcontainer.servlet.exception.ServletNotFoundException: Servlet Not Found: FormLoginServlet
    with regards
    Siddharth
    ([email protected])

    Hi,
    I am using form bases athentivation in WebSpahe Application Server.
    When I am send the login.jsp then this exception is comming
    com.ibm.ws.webcontainer.servlet.exception.ServletNotFoundException: Servlet Not Found: FormLoginServlet
    with regards
    Siddharth
    ([email protected])

  • Package javax.servlet not found error

    package javax.servlet not found error. how it can be solved.
    plz help this is my first servlet program.
    vipin

    You need a jar file that has in it the javax.servlet.* classes
    It should be distributed with your servlet/jsp server.
    It can normally be found in a /lib directory under the installation.
    Some examples:
    Tomcat4: install_dir\common\lib\servlet.jar
    Tomcat5: install_dir\common\lib\servlet-api.jar; install_dir\common\lib\jsp-api.jar
    J2sdkee: install_dir/lib/j2ee.jar
    You need to include this jar file in your classpath when you compile any servlet.

  • Why i get servlet exception/login servlet not found exception  with .ear ?

    I am able to deploy my war and after that generating the ear from that. both works fine in local system.
    But when i run (Jboss as service[Java Service Wrapper]) it takes war without any problem.But with ear file i am getting servlet not found exception.I can't understand where this problem is coming from.
    Even if i take my JSPWIki ear which is running well in production server, this also gives same error.
    One more thing, the files, what i am running well in local system i.e. war and ear working fine. (can't test in production server so testing in same kind of testing server) there also getting login servlet not found exception. Even in same location other files which are deployed are working fine.out of 4 at least one is working fine.
    I don't undersatnd where this whole problem is .
    Please guiide me where sholud i concentrate to solve this problem.
    thnaks
    Vijendra

    I took the source code including the dll files already added to the project from here:
    spazzarama/Direct3DHook
    The solution include two projects the one name Capture is class library type and the dll that make the exception is in this project.
    I tried now to use the program Dependency Walker on this dll file and it found error/s:
    This is the log:
    Error: At least one required implicit or forwarded dependency was not found.
    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    Warning: At least one delay-load dependency module was not found.
    Screenshot:
    It happen only when using/detecting Direct3D 11 . So far only in Direct3D 11, When i use it with a game that run Direct3D 9 it's working fine.
    The question is how can i solve this dll problem ? Any site/place to download this dll from ?

  • Javax.servlets not found

    when i try to import the javax.servlet's, it is not found... any idea where i can go toget that? i downloaded the seperate elipse for J2EE and tried it on there, and i also tried it on the eclipse for regular java developers.
    thanks
    update: it turns out that eclipse has a # of requirements that it needs to get the WTP, i'll appreciate any assistance in directing me toward the files.
    Edited by: ixxalnxxi on Jun 17, 2008 3:30 AM

    No, you need to specify the application server in the eclipse project. Then it will take its libraries in the build path.
    You may find this tutorial useful, you can just skip the JSF part if you aren't planning to use it: [http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html].

  • Servlet not found error

    Hi everyone,
    i am trying to write a chat application using applet,servlet and RMI.
    so i have my servlet and aaplets accordingly...
    but when i put my servlet and applets in their respective folder of tomcat,i am getting and error..which is as follows....
    Resource not found: http://10.0.2.65:8080/servlet/ChatServlet
    The configuration that i am using is:
    1)win XP
    2)Tomcat5.1
    3)JDK 1.5
    my servlet file is 'ChatServlet.class',which is placed in a package(or folder) called 'servlet'...
    so i have place the whole package(servlet) in WEB-INF...
    and the mapping that i have given in web.xml is as follows:
    <servlet>
    <servlet-name>ChatServlet</servlet-name>
    <servlet-class>ChatServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ChatServlet</servlet-name>
    <url-pattern>/ChatServlet</url-pattern>
    </servlet-mapping>
    NOW is that mapping correct??
    Do you find anything wrong in the way i have put my files in Tomcat??
    and also if possible please tell me for what is these mapping in web.xml used??
    thanx in advance

    thanx a lot for the reply...
    i did put the full class name of the servlet....but had no success....
    now my maaping is as follows:
    <servlet>
    <servlet-name>ChatServlet</servlet-name>
    <servlet-class>servlet/ChatServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ChatServlet</servlet-name>
    <url-pattern>/ChatServlet</url-pattern>
    </servlet-mapping>

  • Servlet not found !

    Hi all,
    I have a war file to deploy under Sun ONE 7Update 4, when i deploy it i call a jsp page in it and it is displyed.
    When from this page i call a servlet as :
    http://localhost/test/servlet/db
    I got an error 404 that the resource /test/servlet/db is not found, but in the web.xml the servlet is mapped like :
    <servlet>
    <servlet-name>db</servlet-name>
    <servlet-class>org.test.db</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>db</servlet-name>
    <url-pattern>/db</url-pattern>
    </servlet-mapping>
    Any suggestion ?
    Cheers.
    Stefano

    Try http://localhost/test/db

  • How To Configure JRun Classpath--Servlets Not Found

    How do I get JRun to pick up my classes in Unix? I have a WAR
    application that works fine in Windows on a local copy of JRun4. If
    I deploy it to Unix (making sure I haven't introduced any issues
    such as ^M characters, of course), I find that my JSPs can be
    picked up but the first time I attempt to access a servlet, it
    turns up not found. The Servlet .class file is located in the
    correct package in the WEB-INF/classes/ directory. Although I
    should have been able to access it by mapping the URL in the
    web.xml (which doesn't work even on the Windows copy, subject of
    another question), even when I give the explicit name of the
    servlet, i.e. /servlet/com.myco.myservlet.MyServlet, it is not
    found.
    Please explain to me what I have to do to permit my Servlets
    to be picked up. I have tried putting an explicit classpath in the
    startup script, i.e.: -cp
    ./.../servers/default/mywar/WEB-INF/classes/ but it does not make a
    whit of difference. What gives? What must I do so that my classes
    are picked up?
    Thank you.

    Hi, Guenther:
    You can use <error-page> element of web.xml. Add an element to your web.xml like
    <error-page>
    <error-code>404</error-code>
    <location>/404.jsp</location>
    </error-page>
    or
    <error-page>
    <exception-type>java.io.IOException</exception-type>
    <location>/myException.html</location>
    </error-page>
    Both of them work when I try 10.1.2. This mechanism is a j2ee standard. You might want to search the web for "error-page" and "web.xml" or look at the j2ee specfication. Hope this helps you.

  • 404 Not Found : Servlet not found on this server

    I have been trying to run a simple servlet from a JSP page. For some reason I keep getting an error informing me that the servlet in question cannot be found on the server. I have incuded some code from my project in the hope that it may provide a clue to the problem. I would appreciate any help.
    from the web.xml file
    <servlet>
    <servlet-name>MapTestServlet</servlet-name>
    <servlet-class>Common.MapTestServlet</servlet-class>
    </servlet>
    from the JSP page
    <FORM ACTION="\PATSCoreROC\classes\Common.MapTestServlet" METHOD="post">
    <INPUT TYPE="SUBMIT" NAME="Test" VALUE="Test Servlet">
    </FORM>
    Clicking the Test Servlet button produces the following 404 error in the browser
    404 Not Found
    Resource /PATSCoreROC/classes/Common.MapTestServlet not found on this server

    After a little work and some coffee I tried the following and it resolved my problem.
    <FORM ACTION="servlet\Common.MapTestServlet" METHOD="post">
    <INPUT TYPE="SUBMIT" NAME="Test" VALUE="Test Servlet">
    </FORM>
    I should have included 'servlet\' in the ACTION property.

  • Servlet not found exception.

    I have deployed war file on weblogic server. when i try to fetch some
              servlet from web browser say, http://localhost:7001/myapp/myservlet ,
              sometimes i get the following error " /myapp/myservlet not found ".
              but on the other hand sometimes it does retrieves it properly. Does any body
              know how to solve this problem?
              Any help in this regard is appreciated.
              Thanks
              -Shree
              

    Hello
    More info is needed. What is the name of the application given in the descriptor file? what is the welcome file? How are you invoking it?
    Regards
    Alejandro

  • Package javax.servlet not found in sdk 1.4.0_01

    Hi,
    Please correct me if i'm wrong. I was using j2sdk 1.3.1 (standard edition) and have recently upgraded to j2sdk1.4.0_01. I can't find the javax.servlet package in the API. I referred to the j2ee sdk and found the package there. Does it mean that I need to have both the j2sdk1.4.0_01 and the j2sdkee1.3.1 (j2ee) in order to be able to compile and run my codes?
    Thanks.
    Karen

    The servlet packages don't come with the standard SDK.
    You can get them from javasoft.com or if you use the
    Tomcat server they come packaged in a jar file called
    servlet.jar

  • My servlets not found the EJB

    Hi,
    I have a Servlet with the following code:
    Hashtable env = new Hashtable();
    env.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "adminmanager");
    env.put(Context.PROVIDER_URL, "http://127.0.0.1:7007");
    Context ctx = new InitialContext(env);
    Object objref = ctx.lookup("Calc");
    homecalc = (CalcHome)PortableRemoteObject.narrow(objref,CalcHome.class);
    But when i execute the servlet by http://...
    the server say java.lang.NullPointerException and not execute the EJB and finalize
    the servlet normally.
    what is bad?
    Thanks in advance,
    Juan Uribe.

    Hi,
    I have a Servlet with the following code:
    Hashtable env = new Hashtable();
    env.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "adminmanager");
    env.put(Context.PROVIDER_URL, "http://127.0.0.1:7007");
    Context ctx = new InitialContext(env);
    Object objref = ctx.lookup("Calc");
    homecalc = (CalcHome)PortableRemoteObject.narrow(objref,CalcHome.class);
    But when i execute the servlet by http://...
    the server say java.lang.NullPointerException and not execute the EJB and finalize
    the servlet normally.
    what is bad?
    Thanks in advance,
    Juan Uribe.

  • Class javax.servlet.Servlet not found - problem

    Hello,
    i'm using intellij and tomcat . when i try to configure intellij to use tomcat it says that it doesn't find javax.servlet.Servlet class.
    i'm using jdk1.5.0_05. what can i do to fix this error?
    tnx,
    clauditza

    ok!
    and where can i find this particular jar? i have searched it on java.sun.com, but all i could find was j2ee that includes support for servlets

  • IsItWorking Servlet not Found Error

    Hi All
    After i installed the Oracle 9i App Server on win2k Server , when i tried to access the IsItWorking Servlet through the jserv engine using the following URL
    http://localhost:7778/servlet/IsItWorking , I get the following error in the error log of the Apache WebServer.
    File does not exist: /servlet/IsItWorking
    What could be the problem? The configuration files ,jserv.conf,jserv.properties and zone.properties havent changed.
    can someone pls help.
    Thanx in advance.

    Thanx Andrew for the reply.
    I tried to search for the entry orcladmin and the search fails with an Error code 106(Search criteria doesnt match any entries.This bamboozled me completely as iam logged into the OID thru ODM but cant find the orcladmin entry...something bad....
    Then I relaised that my SSO COnfiuration Assistant/Internet Directory Configuration Assistant must have failed.
    This is what is happening.
    My Oracle Internet Directory Server(OID) is running on port 389(non-ssl default) and the configuration assistants are trying to connect to port 4032.
    I Tried 2 WorkArounds which failed
    WorkAround 1: Tried Runnning the OID on port 4032
    I tried to run the OID on port 4032 using
    (oidctl connect=iasdb server=oidldapd instance=1 flags='-p 4032' start)
    but it fails.I could see it from the LDAP LOGS ($ORACLE_HOME\ldap\logs\oidmon.log)..The OID Monitor just adds that instance and deletes it from the registry as it is unable to start the OID Server..
    But other instances could be started on port 389 though...
    WorkAround 2:
    I tried to run the SSOConfigAssistant from the command line as :
    java -jar D:\oracleinfra\sso\lib\ossoca.jar D:\oracleinfra orasso orasso
    hydtrn01.mydomain.com 389 "orcladmin" welcome hydtrn01.mydomain.com 1521
    iasdb AMERICAN_AMERICA.WE8MSWIN1252
    But this throws me off giving an error.
    Failed to obtain OiD password. Exception is :java.lang.Exception: Version mismat
    ch!.
    Iam not sure wherez the SSoConfigAssistant getting the OID Passwd from...
    Iam not sure as to how to proceed frm here other than Reinstalling...Also the Unistallation isnt clean as it leaves a lot of entries in the registry on win2k..
    Any help would be mightly appreciated
    Thanx in Advance.

Maybe you are looking for

  • HT1483 how do i get photos back after a recent update on my ipod?

    I just came back from a family reunion and took SOO MANY pictures. When I came home I just decided I should update my ipod touch but I didn't realize it would restore. So without saving my pictures prior the update its all gone. I REALLY need to get

  • USE OF FUNCTION FORM_SUCCESS

    Hi, Can any one please tell me if i can use FORM_SUCCESS with CLIENT_HOST command? The code is as follows. l_host_cmnd := ' ftp –s:' || l_ftp_destination || '/' || 'temp.txt'; HOST( l_host_cmnd, NO_SCREEN); if not form_success then message(The file

  • Deleting read source file

    can we delete the read source file once it is successfully transferred to target location?

  • Photoshop CS3 Color Range Problem

    I am having an issue with the color range selection tool in Photoshop CS3 on an iMac G5 running Snow Leopard. I've been using this tool for years and it's always worked properly until now. It no longer selects the color I've picked with the eyedroppe

  • No sound in QT 7.1.3....again!

    I had to get rid of QT 7.1.2 and go back to 7.1.1 last time because I lost all sound in QuickTime when I installed it. After hesitating initially I figured they'd probably fixed the problem and updated to 7.1.3. Nup! Sound is gone again. Doesn't work