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 Tomcat 4.0.1  -  cannot create bean of class 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 "Tomcat 4.0.1  -  cannot create bean of class " Watch "Tomcat 4.0.1  -  cannot create bean of class " New topic
Author

Tomcat 4.0.1 - cannot create bean of class

Francois Bourgault
Ranch Hand

Joined: Oct 30, 2001
Posts: 67
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.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Some containers require that the class be in a package. if you don't have one, create one.
class="yourPackageName.InfoBean"

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Oct 30, 2001
Posts: 67
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.
 
wood burning stoves
 
subject: Tomcat 4.0.1 - cannot create bean of class
 
Similar Threads
JSP:Include question
bean:define cannot instaniate new bean?
tomcat jsp question to ask
jsp:useBean Topics
Having trouble getting Vector out of a bean in JSP