• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet JSP Link error

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Tomcat are you using?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
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
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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sorry to bother you all.



Don't be.
Thanks for reporting back with your solution.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic