This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet JSP Link error

 
Pradipta Ghosh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ryan Muster
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have an older j2ee.jar in your JDK directory structure somewhere?
 
Pradipta Ghosh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to bother you all.


Don't be.
Thanks for reporting back with your solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic