[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: JSP - JavaBEAN basic trouble..


Hi Pete,

"Pete." wrote:
> I am trying to use Beans with a gnujsp(latest version) enabled web
> server and cannot seem to get them started.  I saw one other post on
> this thread which had the same problem as I did, but it was not resolved
> publicly.
> 
> I have .JSP page: (note: I do have other JSP pages without beans working
> fine)
>     <html>
>     <BEAN name = "trytest" type = "jsp.beans.test"
> scope="session"></BEAN>
>     <h2> Sample JSP page Output </h2>
>     <br>
>     <%= trytest.getFoo() %>
>     </html>
> 
> and a java class (test.class):
>     package jsp.beans;
>     import java.io.Serializable;
>     public class test implements Serializable {
>         private int i = 10;
>         public int getFoo() {
>              return i;
>         }
>     }
> 
> upon accessing the test.jsp page, I get an INTERNAL SERVER ERROR 500,
> and jserv.log shows:
>     ajp11: Servlet Error: java.lang.ClassCastException: jsp.beans.test:
> jsp.beans.test
> 
> any ideas?
> 
> I am a student doing this for a class project and don't have much
> experience with java / jsp / apache / jserv, and NO experience with java
> beans, but I have read lots of the information on the SUN and other
> sites about it all.

When using beans from JSP pages there a number of class loader related
problems. I am trying to solve them (or at least locate them) at the
moment. In the meantime, placing your beans in the system classpath
should solve some of your problems.

Regards, Vincent.