• 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

Tomcat 4.0.1 - cannot create bean of class

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to instantiate a very simple bean on Tomcat in a JSP using the directive... <jsp:useBean id="sessionBean" scope="session" class="InfoBean" /> Everytime I try to run it, I get the following exception... javax.servlet.ServletException: Cannot create bean of class InfoBean Any idea why this is happening... The bean has a default constructor.
I have deployed my Beans package in the WEB-INF/classes directory for this program.
This is the useBean tag copied directly from my JSP: <jsp:useBean id="guest" class="Beans.Guest_Bean" scope="session"/>
FYI: This was working using tomcat 3.2.x
Any help is greatly appreciated.
Francois.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some containers require that the class be in a package. if you don't have one, create one.
class="yourPackageName.InfoBean"

Bosun
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are your bean classes in the same WEB-INF/classes directory as the webapp in which you want to use them?

 
Francois Bourgault
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,
Everything is under the same webapp. Bean classes are kept in web-inf\classes\beans and there's a package stmt: Beans in the javabeans itself. Seems like I can get to the bean(no more package not found error) but obviously can't create it.
Below is the error generated by tomcat: just the 1st line
javax.servlet.ServletException: Guest_Bean
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
In server.xml, I have the context of Beans:
<Context path="/myServlets/Beans" docBase="Beans" debug="0" privileged="true"/>
Seems like there's something wrong with the context.. What am I missing here?
Francois.
 
reply
    Bookmark Topic Watch Topic
  • New Topic