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

Error: Can not create bean of class Myclass

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Juan Zhang
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sam,
Thank you very much for your help. Now this example works.
Again thanks
Juan
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic