The moose likes JSP and the fly likes Strange error - Bean not found in scope Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Strange error - Bean not found in scope" Watch "Strange error - Bean not found in scope" New topic
Author

Strange error - Bean not found in scope

Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319
Hey!
The JSP spec (and my common sense) says that if a bean is not found, it will be instantiated. But when i try to use a bean using the <jsp:useBean> tag it reports the following error
(truncated the long stack trace)
The bean phoneBook, which is referred does have a public no argument constructor.
The class exists in the \WEB-INF\classes\ folder. Other classes in the same package have no problem in instantiation.
The servlet container is Tomcat 4.1.18.
Whats wrong?
thanks
sudharsan
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
It might help if we could see the JSP code. One reason you might get something like this is if you did a usebean for "PhoneBook" and then later referenced it as "phoneBook".


Jason's Blog
Marty Hall
Author
Ranch Hand

Joined: Jan 02, 2003
Posts: 111
...But when i try to use a bean using the <jsp:useBean> tag it reports the following error...

Are you sure that it is the jsp:useBean tag that causes the error? Maybe it is a jsp:getProperty or jsp:setProperty tag? Maybe put in some
<% System.out.println("..."); %>
statements to be sure?
Cheers-
- Marty


Java training and consulting<br /><a href="http://www.coreservlets.com/" target="_blank" rel="nofollow">http://www.coreservlets.com/</a>
Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319
Marty,
Just a single line of JSP code was enough to reproduce this error. I tested with a jsp file containing only this line

And I'm sure abt the spelling of the id value.
-sudharsan
 
 
subject: Strange error - Bean not found in scope
 
Threads others viewed
Problem in usebean
Package...not found in import
problem encountered while using jsp:getProperty tag
getting value in logic iterate
phonebook in bluej
IntelliJ Java IDE