dcsimg
javax.servlet.ServletException: Cannot create bean of class UserData
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shahabuddin_Ansari
Posted On:   Sunday, November 4, 2001 05:39 PM

I am trying to create a very simple bean and getting the above error. Does anybody got any clue to this one?

Re: javax.servlet.ServletException: Cannot create bean of class UserData

Posted By:   Falk_Friedrich  
Posted On:   Monday, December 3, 2001 05:56 AM

I think you tried to access the bean within jsp, is it correct? It seems that something prevent the engine to instantiate the bean using Beans.instantiation(..) and the output doesn't give a clue where the problem is exactly. Try out this, look at the source which is converted from jsp to java. There must be a code fragment which looks like the following:
...

mypackage.MyBean = null;
boolean _jspx_specialtranslate = false;
synchronized (session)
{
bean = (mypackage.MyBean)page...
...
try {
bean = (mypackage.MyBean)Beans.instantiate(this.getClass().getClassLoader(), "mypackage.MyBean");
}catch (Exception exc){
// include exc.printStackTrace()
throw new ServletException (" Cannot create bean of class "+" mypackage.MyBean" /*include + exc.getMessage() */);
}
}

Very poor example I know, but you can try to integrate the whole synchronized block from this source, making some changes in the catch block to get the exact reason of that exception.
And for this try you have to remove the jsp:useBean tags! Look what's happen if you call the page. Maybe ther is a problem in the bean itself, but you will find out it when you read the exception.
Hopefully I could help.

Re: javax.servlet.ServletException: Cannot create bean of class UserData

Posted By:   jjfat_jjfat  
Posted On:   Sunday, November 4, 2001 11:17 PM

I think it doesn't find the bean you created!
You'd better add something like this:
package bean;
About | Sitemap | Contact