This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Error: Can not create bean of class Myclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error: Can not create bean of class Myclass" Watch "Error: Can not create bean of class Myclass" New topic
Author

Error: Can not create bean of class Myclass

Juan Zhang
Greenhorn

Joined: Apr 19, 2001
Posts: 13
Hi,
I�m learning Servlet and JSP from the book called �core Servlets and JavaServer Pages� by Marty Hall. When I tried to run an example on page 360, I got an error as shown below:
Error:500
Location: /travel/BookFlights.jsp
Javax.servlet.ServletException: Can not create bean of class JSPpackage.TravelCustomer at��.
My servlet classes are located in D:/jakarta-tomcat-3.2.1/webapps/ROOT/WEB-INF/classes/JSPpackage directory. My �.jsp� files and �.html� file are located in D:/jakart-tomcat-3.2.1/webapps/travel directory. I�m using JBuilder3 and IE5. I am not able to figure out what caused the error, Please advise.
Thanks in advance
Sam Dalton
Author
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
Try putting your classes in the D:/jakart-tomcat-3.2.1/webapps/travel/WEB-INF/classes directory. This will make them avaliable to the JSP's in your travel web application.
Rgds
S


<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
Juan Zhang
Greenhorn

Joined: Apr 19, 2001
Posts: 13
Hi, Sam,
Thank you very much for your help. Now this example works.
Again thanks
Juan
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
On this same type of error, sometimes we expect that a bean will be in the scope we want or expect it to be for a JSP and it isn't by mistake. In those instances, the server will try to instantiate a bean for you and if that bean does not have a default constructor, it will spew out a similar exception.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error: Can not create bean of class Myclass
 
Similar Threads
Class not found
Help! Can't create Web-apps in Tomcat!
simple JSP and JavaBean, error 500
Help Me for running JSP/Java/Classes Code
javabean in tomcat