aspose file tools*
The moose likes Servlets and the fly likes HTTP Status 404 - Servlet Not Found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 - Servlet Not Found" Watch "HTTP Status 404 - Servlet Not Found" New topic
Author

HTTP Status 404 - Servlet Not Found

dj padilla
Greenhorn

Joined: Mar 25, 2010
Posts: 7
Good day all,

I am writing my first web app and am experiencing an issue with a servlet (I only have one ). When accessing my servlet via URL, I receive the below error:
HTTP Status 404 - /TiffanyPadilla/servlet/HelloWho
type Status report
message /TiffanyPadilla/servlet/HelloWho
description The requested resource (/TiffanyPadilla/servlet/HelloWho) is not available.
JBoss Web/2.1.6.GA

I have completed the following in order to make (or try to make) it work:

Edit the web.xml file for the web app (located at TiffanyPadilla.war/WEB-INF/lib/web.xml):

Created a context.xml (located at TiffanyPadilla.war/META-INF/context.xml):

The app also deployed fine, with no errors:

Using the following resources:
  • Mac OS X
  • JBoss 6.0
  • Netbeans 6.8

  • Would someone mind helping me figure out why I get the error? Please let me know if you need further details.


    - DJ
    Seetharaman Venkatasamy
    Ranch Hand

    Joined: Jan 28, 2008
    Posts: 5575

    your web.xml is weird,It contains servlet-mapping for Invoker servlet which is in server.xml normaly . and I dont find suitable url-pattern of servlet-mapping.

    Note : try to avoid Invoker Servlet,It will tie you in certain area
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    Hi Seetharaman,

    Thanks for the reply. In order to secure the server, I have left the servlet for the Invoker commented out in the jboss server xml file, and allowed it explicitly in this web app. Unfortunately, this is for a my Advanced Java class and can't get around allowing this. I need to be able to call a servlet explicitly via the browser.
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    Hi all,

    I tried to mess with a few things, and am now back to the error i started with:

    2010-03-25 21:55:05,717 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/TiffanyPadilla]] (HDScanner) Servlet /TiffanyPadilla threw load() exception
    java.lang.SecurityException: Restricted class: org.apache.catalina.servlets.InvokerServlet


    Argh! How frustrating!
    Saifuddin Merchant
    Ranch Hand

    Joined: Feb 08, 2009
    Posts: 605

    Maybe these post might help,

    http://www.coderanch.com/t/477865/JBoss/do-enable-invoker-servlet-JBoss
    http://www.coderanch.com/t/87535/Tomcat/Security-Exception-while-starting-tomcat

    I did not understand why you need to use the invoker-servlet at all.


    Cheers - Sam.
    Twisters - The new age Java Quiz || My Blog
    David Newton
    Author
    Rancher

    Joined: Sep 29, 2008
    Posts: 12617

    Agreed--there's little reason to use the invoker servlet, and good reasons not to. If you need to invoke known servlets, just map them.

    In any case, servlets must be in a package other than the default package.
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    Thanks all,

    I appreciate your help. I've actually read and re-read the posts mentioned, but I can't seem to enable invoking my individual servlet. This is just for a class, and running on my Mac, so I'm not worried about security. If someone has another idea about how I can enable the ability to invoke my servlet via browser I would greatly appreciate it. For now, I took your advice and removed the invoker servlet from my web.xml and placed my individual HelloWho servlet in a package called Hello.

    Any other suggestions? I'm still faced with a 404.

    Thanks!
    David Newton
    Author
    Rancher

    Joined: Sep 29, 2008
    Posts: 12617

    Did you put the servlet into a package other than the default package, like I mentioned previously?
    Saifuddin Merchant
    Ranch Hand

    Joined: Feb 08, 2009
    Posts: 605

    Could you post the new web.xml and the URL you are trying to hit. Hope you remember that the URL are CaSe sensitive!
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    David Newton wrote:Did you put the servlet into a package other than the default package, like I mentioned previously?

    From my last post...
    For now, I took your advice and removed the invoker servlet from my web.xml and placed my individual HelloWho servlet in a package called Hello.
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    Sam Mercs wrote:Could you post the new web.xml and the URL you are trying to hit.


    web.xml

    URL
    http://localhost:8080/TiffanyPadilla/servlet/HelloWho

    Sam Mercs wrote:Hope you remember that the URL are CaSe sensitive!

    I understand case sensitivity. The below error, as provided in the initial post displays the URL I'm entering in the error...
    HTTP Status 404 - /TiffanyPadilla/servlet/HelloWho
    dj padilla
    Greenhorn

    Joined: Mar 25, 2010
    Posts: 7
    I'd like to be able to directly access my servlet via browser, if anyone has an idea how to do that it would be greatly helpful!
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61215
        
      66

    Package names should be all lowercase.

    Where did you put the class file? Without complete information, it's hard to help.


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    David Newton
    Author
    Rancher

    Joined: Sep 29, 2008
    Posts: 12617

    The URL should be /HelloWho, as the mapping is (if you're deploying to the root context), not /servlet/HelloWho.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: HTTP Status 404 - Servlet Not Found