Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

HTTP Status 404 - Servlet Not Found

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    Ranch Hand
    Posts: 5575
    Eclipse IDE Windows XP Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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!
     
    Ranch Hand
    Posts: 607
    Firefox Browser Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Maybe these post might help,

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

    I did not understand why you need to use the invoker-servlet at all.
     
    Author
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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 Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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!
     
    Sheriff
    Posts: 67637
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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.
     
    Message for you sir! I think it is a tiny ad:
    ScroogeXHTML - fast RTF to HTML and XHTML conversion
    https://coderanch.com/t/749563/ScroogeXHTML-fast-RTF-HTML-XHTML
    reply
      Bookmark Topic Watch Topic
    • New Topic