You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brandon Cruz <bc...@norvax.com> on 2001/04/11 00:54:24 UTC
Instantiating Beans on Tomcat
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, my java code doesn't have anything in it
yet, I just want to test it so that the bean will work, here is what I have
in the java in case I have that wrong...
public class InfoBean {
private String sample = "Sample";
public InfoBean() {
}//end constructor
public String getSample() {
return sample;
}
public void setSample(String newSample) {
sample = newSample;
}
}
Any ideas on what I'm doing wrong, could this be due to some session
settings in Tomcat?
Thanks!
Brandon
RE: Instantiating Beans on Tomcat
Posted by Brandon Cruz <bc...@norvax.com>.
Yeah, there must be something I'm missing, maybe there's some setting in
tomcat which allows me to use beans or something, but I can't find where
that would be.
Brandon
-----Original Message-----
From: Hunter Hillegas [mailto:lists@lastonepicked.com]
Sent: Tuesday, April 10, 2001 6:00 PM
To: Tomcat User List
Subject: Re: Instantiating Beans on Tomcat
I was getting those but it was because my bean didn't have a constructor
that took no args but it looks like yours does...
Not sure...
Hunter
> From: "Brandon Cruz" <bc...@norvax.com>
> Reply-To: tomcat-user@jakarta.apache.org
> Date: Tue, 10 Apr 2001 17:54:24 -0500
> To: <to...@jakarta.apache.org>
> Subject: Instantiating Beans on Tomcat
>
> 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
Re: Instantiating Beans on Tomcat
Posted by Hunter Hillegas <li...@lastonepicked.com>.
I was getting those but it was because my bean didn't have a constructor
that took no args but it looks like yours does...
Not sure...
Hunter
> From: "Brandon Cruz" <bc...@norvax.com>
> Reply-To: tomcat-user@jakarta.apache.org
> Date: Tue, 10 Apr 2001 17:54:24 -0500
> To: <to...@jakarta.apache.org>
> Subject: Instantiating Beans on Tomcat
>
> 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