on 10-29-2004 9:07 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sajeev, thanks, misery loves company!
Bojidar,
Perhaps this confirms your hypothesis that the jsp is not getting compiled. When I request the jsp directly (http://localhost:50000/QuickCarRental/quickCarRentalView.jsp), I get the following application error:
...
Details: com.sap.engine.services.servlets_jsp.server.jsp.exceptions.CompilingException: Error in executing the compilation process: C:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/QuickCarRentalApplication/servlet_jsp/QuickCarRental/work/jsp_quickCarRentalView1099491099295.java:51: illegal start of expression
=session.getAttribute(Constants.CLIENT_MESSAGE)
^
C:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/QuickCarRentalApplication/servlet_jsp/QuickCarRental/work/jsp_quickCarRentalView1099491099295.java:75: illegal start of expression
=value
^
...
By contrast, I have successfully deployed and executed Karl Kessler's flight reservation exercise (May/June SAP Professional Journal), whose front end is only a jsp, no servlet. That app executes correctly from http://localhost:50000/FlightApp/selection.jsp. In both cases, the physical jsp file is stored under sap.com/<Application Name>/servlet_jsp/<Context root>/root.
But I want to rent a car, not a flight! So going back to Sajeev's and my problem - We have correctly, we believe, followed the tutorial's instructions for creating and deploying the JAR, WAR, and EAR. So what's the fix?
Hi Randal,
I received the jsp file.
The problem is in this code lines :
<b><%
=session.getAttribute(Constants.CLIENT_MESSAGE)
%></b>
This is considered as "expression" by JSP specification. The correct syntax for it is to start with <b>"<%="</b>. As can be seen in the line above, there is no such string at begin(but in the tutorial it is correct).
Maybe this is a "copy/paste" problem:)
The correct line is :
<b><%=session.getAttribute(Constants.CLIENT_MESSAGE)%></b>
I saw the same error farther So if you correct all expressions, the jsp should be compiled.
Regards
Bojidar
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?
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.