You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dmitri Colebatch <di...@nuix.com.au> on 2001/07/04 10:00:13 UTC

Re: probs in bean creation

Hi,

On Thu,  5 Jul 2001 02:58, Suresh Manne wrote:
> javax.servlet.ServletException:  Cannot create bean of
> class my_classes_folder.my_class_file

What does your bean look like?  Firstly, I'm assuming it has "package 
my_classes_folder" at the top of it.  Secondly, the main reason I find those 
errors are the lack of a null argument constructor.  To use that useBean tag 
the way you are, you should have something like:

package my_classes_folder;

public class my_class_file
{
	public my_class_file() { }	
}

You might also have other things, I'm assuming you do, but that is the bare 
minimum.  However, you're not at all following conventions.  The above should 
be

package myPackage;

public class MyClass
{
	public MyClass() { }
}

which would have the following useBean tag:

<jsp:useBean id="cs" class="myPackage.MyClass" scope="request" />

DOes that make sense?

cheers
dim

RE: probs in bean creation

Posted by Suresh Manne <su...@indbrain.com>.
Thanks Dim,
  Yes there is
 package myPackage, also I have a public constructor as you mentioned .

package myPackage;
public class MyClass
{
	public MyClass() { }
}

and I use the bean as:

<jsp:useBean id="cs" class="myPackage.MyClass" scope="request"/>
<jsp:setProperty name="ps" property="*"/>

then i get the same error saying:
javax.servlet.ServletException:  Cannot create bean of class
myPackage.MyClass

What else could be wrong? Please help me out.. I am really bugged with this
error.

Thanks,
Suresh.


-----Original Message-----
From: Dmitri Colebatch [mailto:dim@nuix.com.au]
Sent: Wednesday, July 04, 2001 3:00 AM
To: tomcat-user@jakarta.apache.org; Suresh Manne
Subject: Re: probs in bean creation


Hi,

On Thu,  5 Jul 2001 02:58, Suresh Manne wrote:
> javax.servlet.ServletException:  Cannot create bean of
> class my_classes_folder.my_class_file

What does your bean look like?  Firstly, I'm assuming it has "package
my_classes_folder" at the top of it.  Secondly, the main reason I find those
errors are the lack of a null argument constructor.  To use that useBean tag
the way you are, you should have something like:

package my_classes_folder;

public class my_class_file
{
	public my_class_file() { }
}

You might also have other things, I'm assuming you do, but that is the bare
minimum.  However, you're not at all following conventions.  The above
should
be

package myPackage;

public class MyClass
{
	public MyClass() { }
}

which would have the following useBean tag:

<jsp:useBean id="cs" class="myPackage.MyClass" scope="request" />

DOes that make sense?

cheers
dim