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

Servlet JSP Link error

Pradipta Ghosh
Greenhorn

Joined: Nov 03, 2007
Posts: 7
Anybody who read the book "Head First Servlet & JSP". In Chapter 3 "Hands on MVC"
they prepare the first website with JSP & servlet. I write the exact code written in book
Upto version 2 servlet the code runs fine. But in version 3 servlet when JSP introduced
the final codes become as follows:

------BeerSelect.java---------


But during run when submitting query, it opens the link "http://localhost:8080/Beer-v2/SelectBeer.do"

but with following error

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ELResolver
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:274)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.example.web.BeerSelect.doPost(BeerSelect.java:21)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

and so the error continues .......

Can you please tell me what is the error? I have done everything exactly written in book.
Thanks in advance.


[BSouther: Added UBB CODE tags]
[ November 11, 2007: Message edited by: Ben Souther ]

Pradipta Kumar Ghosh
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What version of Tomcat are you using?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Was this line copied exactly from the book?
}catch(IOException ex){}


This line stops the JVM from telling what is going wrong when an IOException is thrown.
You should either throw the exception up to the container to handle or, if you're not going to do that, at a minimum, log what's going on.

[ November 11, 2007: Message edited by: Ben Souther ]
Ryan Muster
Greenhorn

Joined: Nov 11, 2007
Posts: 18
Just missing a class somewhere....

Thing you need to understand is that JSP are not compiled until they run, so that makes this sort of thing a pain in the butt.

Just do this... if you using netbeans, right click on the JSP page itself and compile it... it will take you to the line of code.
Then just right click on that and look at the JavaDocs... add the class it wants to your imports.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Originally posted by Ryan Muster:
Just missing a class somewhere....

No, there's more to it than that. The class that is reported missing is not just any old class but an integral one to JSP. This indicates a configuration mismatch somewhere along the line.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ryan Muster
Greenhorn

Joined: Nov 11, 2007
Posts: 18
Yes you right...

Add el-api.jar el-impl.jar to the libs its looking for EL language.

I cant see any EL in this page, buts its possible that you been playing with JSTL and have lost the libs.

Still try compile that page... it must find it for you, if not just add those libs... try compile all the jsp pages...

It is a weird 1
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

As of JSP 2.0 the EL and JSTL are separate, with the EL being part of JSP. There should be no need to hunt down and add jars to support the EL. If the container doesn't have the required jars, it either doesn't support JSP 2.0 or the installation has been corrupted.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Do you have an older j2ee.jar in your JDK directory structure somewhere?
Pradipta Ghosh
Greenhorn

Joined: Nov 03, 2007
Posts: 7
Thanks all for replying my queries. There is an error in Tomcat 6.0.13 installation. I have installed this tomcat comes with the package of Netbeans 6.0.
That code
< is not in the book. I have written as I also tried this project to run from Netbeans. In the line it reports that it should declared or caught. That's why I add this extra.

That apache Tomcat has some kind of error. It cannot process any JSP files( even webapps\examples). I discovered it at last at late night after severe brainstorming. . I installed another version of Tomcat 6.0.14 and runs my applicaton. It runs fine now. Sorry to bother you all.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Sorry to bother you all.


Don't be.
Thanks for reporting back with your solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet JSP Link error