Skip to Content
author's profile photo Former Member
Former Member

J2EE Car Rental Example

Successfully deployed. But I get an application error:

Details: javax.servlet.ServletException: The requested resource ( QuickCarRental/servlet/quickCarRentalView.jsp ) is not found

at com.sap.examples.quickcarrental.servlet.QuickReservationServlet.doWork(QuickReservationServlet.java:51)

at com.sap.examples.quickcarrental.servlet.QuickReservationServlet.doGet(QuickReservationServlet.java:28)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

...

The error occurs in the dispatcher.forward(request, response) statement in the servlet's doWork() method.

The servlet/jsp mappings in the web.xml look correct to me:

...

<servlet-mapping>

<servlet-name>quickCarRentalView.jsp</servlet-name>

<url-pattern>/view</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>QuickReservationServlet</servlet-name>

<url-pattern>/</url-pattern>

</servlet-mapping>

...

I am a complete novice to servlet/JSP/EJB development. But from the little I know, the deployment to the localhost also seems correct: I find quickCarRentalView.jsp under sap.com/QuickCarRental/root.

Darn, I came this far not to be able to see the application?! Any help is appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 03, 2004 at 09:36 AM

    Hi all,

    the problem maybe is that the jsp , which is described as a servelt quickCarRentalView.jsp is not compiled.

    You can check this by requesting the jsp file directly.

    Regards

    Bojidar

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Yes, this solved the problem! Incidentally, I think it was the Eclipse "pretty printer" (Source->Format) that put caused the problem.

      One other minor (very minor) problem with the tutorial. The jsp outputs a message to the user:

      <body style="font-family:Arial;"> <p style="font-weight:bold; font-size:14pt"> QuickCarRental</p> <br> <table border="0" bgcolor="D2D8E1" cellspacing="2" cellpadding="2" width="720"> <b><font color="red"><%if(session.getAttribute(Constants.CLIENT_MESSAGE)!=null)%> <%=session.getAttribute(Constants.CLIENT_MESSAGE) %></font></b>

      The session attribute actually has the string value "null", which is what gets written out. And that is because the handleRequest method in the QuickReservationServlet sets the attribute to "null":

      public void handleRequest(

      HttpServletRequest request,

      HttpServletResponse response,

      QuickOrderProcessorLocal order)

      throws ServletException {

      HttpSession session = request.getSession(true);

      session.setAttribute(Constants.CLIENT_MESSAGE, null);

      ...

      If I substitute "Hello" for "null," it indeed writes out "Hello." I take that to be a minor design flaw or oversight in the tutorial?

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2004 at 10:44 PM

    Hi Randy,

    I've never tried the CarRental sample, but from the error below it looks like it is trying to forward to an incorrect url. Maybe check the dispatcher.forward() and see where it is forwarding to. Looks like it is trying to forward to servlet/quickCarRentalView.jsp. Check if that relative path is valid. If not, find the correct path to your quickCarRentalView.jsp and correct the url in forward() for it.

    Hope this helps,

    Marc

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Marc (my terrific web services instructor at Teched San Diego!). I'm messed around some more but still can't get it to work. Correcting slightly what I wrote in the original message, the quickCarRentalView.jsp file is physically located in sap.com/QuickCarRentalApplication/servlet_jsp/QuickCarRental/root. I believe, perhaps incorrectly, that that is exactly what "servlet/QuickCarRentalView.jsp" should resolve to. The tutorial uses in the web.xml descriptor a mapping of quickCarRentalView.jsp to "/view" and accordingly in the servlet's doWork method the instantiation of a dispatcher as 'RequestDispatcher dispatcher = request.getRequestDispatcher("/view");'. I think I have done all that correctly, but in the dispatcher.forward statement in the try block immediately following, I still get the exception stated in my original message. With a breakpoint on that statement on stepping into the internal code, I see intriguing variable assignments such as 'this = "/QuickCarRental/view"', 'newURI = "/QuickCarRental/view"', and 'servletPath = "/view"'. Intriguing, but way over my head. With your superior knowledge of servlets/JSPs, can you make anything of this, or do you anyone you know who has successfully done this tutorial?

  • author's profile photo Former Member
    Former Member
    Posted on Nov 02, 2004 at 05:30 PM

    I have EXACTLY the same problem, but was thinking it was me..I have re-done the whole thing a few times, but still get the same error. Surely there must be someone who has done this tutorial or who can inform what can be done to correct this?

    Message was edited by: Sajeev Anand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 01:51 AM

    I have run into this problem. I get this:

    The request can't be processed.

    Details: Requested resource ( QuickCarRental/servlet/quickCarRentalView.jsp ) not found.

    when I: http://localhost:50000/QuickCarRental/view

    Also, if I try this: http://localhost:50000/QuickCarRental

    I get a stacktrace beginning with:

    Application error occurred during the request procession.

    Details: javax.servlet.ServletException: Requested resource ( QuickCarRental/servlet/quickCarRentalView.jsp ) not found.

    at com.sap.examples.quickcarrental.servlet.QuickReservationServlet.doWork(QuickReservationServlet.java:51)

    The problem seems to be that the jsp is not being compiled. I even put a copy of the jsp file in the servlet directory! It still complains.

    How can I compile the JSP file by hand?

    Why is it not compiling it automatically?

    Is there a log file for what it is doing to see why the compile fails or even if it tries to compile it?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 04:42 PM

    Never mind.

    I deleted the jsp file, created a new one, and all is well. The problem was of course that the jsp would not compile. But the bigger problem was that it could not be found to compile it! I don't know how it got fixed!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.