Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 - Servlet Not Found

 
dj padilla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Seetharaman Venkatasamy
    Ranch Hand
    Posts: 5575
    Eclipse IDE Java Windows XP
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 607
    Firefox Browser Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    David Newton
    Author
    Rancher
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Did you put the servlet into a package other than the default package, like I mentioned previously?
     
    Saifuddin Merchant
    Ranch Hand
    Posts: 607
    Firefox Browser Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Pie
    Posts: 65223
    95
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Package names should be all lowercase.

    Where did you put the class file? Without complete information, it's hard to help.
     
    David Newton
    Author
    Rancher
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The URL should be /HelloWho, as the mapping is (if you're deploying to the root context), not /servlet/HelloWho.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic