• 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

JSP page error (Unable to compile class for JSP ) HTTP Status 500 -

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am developing a web application using JavaBeans (MailBean.java) inside a JSP Page with Apache Tomcat/4.1.18-LE-jdk14 and J2sdk1.4 and i keep on having the error "Unable to compile class for JSP" see full error msg below.
Meanwhile My catalina_home directory is d:\Tomcat and it has no \lib subdirectory rather there is a \common\lib directory
However, My JSP code and JavaBean file (MailBean.java) are all stored in my subdirectory called \kenTest which is in the directory d:\Tomcat\webapps\ROOT directory, and I am using the ROOT context

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 6 in the jsp file: /kenTest/feedback.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Tomcat\work\Standalone\localhost\_\kenTest\feedback_jsp.java:46: cannot resolve symbol
symbol : class MailBean
location: class org.apache.jsp.feedback_jsp
MailBean mail = null;
^
An error occurred at line: 6 in the jsp file: /kenTest/feedback.jsp
Generated servlet error:
D:\Tomcat\work\Standalone\localhost\_\kenTest\feedback_jsp.java:48: cannot resolve symbol
symbol : class MailBean
location: class org.apache.jsp.feedback_jsp
mail = (MailBean) pageContext.getAttribute("mail", PageContext.PAGE_SCOPE);
^
An error occurred at line: 6 in the jsp file: /kenTest/feedback.jsp
Generated servlet error:
D:\Tomcat\work\Standalone\localhost\_\kenTest\feedback_jsp.java:51: cannot resolve symbol
symbol : class MailBean
location: class org.apache.jsp.feedback_jsp
mail = (MailBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "MailBean");
^
3 errors

PLEASE GUYS, HELP OUT ASAP.
Merci,
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to compile your bean and then place it inside /yourcontext/WEB-INF/classes
 
kennedy udida
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim, i already did that and it still is not working.
I even shutdown Tomcat and restarted yet it will not work.
My context is D:\Tomcat\webapps\ROOT
And my MailBean.java and class files are stored in a subdirectory in the path D:\Tomcat\webapps\ROOT\kenTest
I further created the directories /WEB-INF/classes and placed my compiled Bean within this folder yet that error persist, what next PLEEEE...EESE?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

And my MailBean.java and class files are stored in a subdirectory in the path D:\Tomcat\webapps\ROOT\kenTest
I further created the directories /WEB-INF/classes and placed my compiled Bean within this folder yet that error persist, what next PLEEEE...EESE?


Well, ROOT already has a WEB-INF so Tomcat does not even recognize your new directory. If you want your application to live under ROOT, your classes will have to be in ROOT/WEB-INF/classes.
Also, be sure your bean class is in a package, and be sure your JSP imports that package.
You should download the full servlet and jsp specifications from Sun and study how web applications are suppoesd to be laid out.
The JSP specifications page
The servlet specifications page.
Bill
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic