Hello Werner,
thank you for your advice, but It didn't helped.
I did now these thinks:
1) I created new directory
/usr/adissys/pok_JSP/SB/vzor/WEB-INF/classes/mesto;
2) I moved Mesto.java from /usr/adissys/pok_JSP/SB/vzor/WEB-INF/classes
directory
to /usr/adissys/pok_JSP/SB/vzor/WEB-INF/classes/mesto directory;
3) I added to Mesto.java one line:
package mesto;
4) I compiled Mesto.java at that new directory: OK (was created file
Mesto.class);
5) I replaced at mesto.jsp the old line
<jsp:useBean id="mes" class="Mesto" scope="page"/>
to the new line
<jsp:useBean id="mes" class="mesto.Mesto" scope="page"/>;
6) I restarted Tomcat;
7) I called mesto.jsp, but the same error persits!
Can you advise why?
Thanks
Mirek Subrt
Werner
Ramaekers To: [EMAIL PROTECTED]
<crypto@pando cc:
ra.be> Subject: Re: JavaBean at JSP
23.10.2000
10:07
Please
respond to
tomcat-user
Hello Mirek,
I had the same problem about a week ago.
You can search the archives for the message entitled :
" JSP : Can not retrieve Object stored from servlet into session"
The solution as explained by Craig Mc Clanahan is :
<QUOTE>
If you want to use a Java class in a <jsp:useBean> action, it *should* be
in
a package.
The reason for this has to do with the way that Java compilers look at
classnames with no packages. They assume that the class is in the same
package as the calling class itself (in this case, the servlet class that
is
generated from your JSP page). However, different servlet containers
generate these servlets into different packages. In order to be portable,
you must put your own beans in packages to make this unambiguous.
The values you specify for the "type" or "class" attributes of the
<jsp:useBean> action must be fully qualified class names (i.e. they must
include the package prefixes).
</QUOTE>
That solves your problem !
c ya
Werner
[EMAIL PROTECTED] wrote:
> Helow Tomcat-friends!
>
> Can somebody help me with the problem of unfinded JavaBean class?
>
> I use an JavaBean Mesto (that means "city" in czech language) at JSP page
> (under Tomcat 3.2 beta 6):
>
> <jsp:useBean id="mes" class="Mesto" scope="page"/> .
>
> Note: this JavaBean has no package directive inside Mesto.java.
>
> When I had installed Tomcat under Windows 95 (and JDK 1.2.2), all worked
> well, but when I had installed Tomcat under unix (AIX 4.1 and JDK 1.1.8),
> my JSP page displays error, that it cannot find my JavaBean class Mesto.
>
> 1) Displayed error
> *******************
> Error: 500
> Location: /pok_JSP/SB/vzor/mesto.jsp
> Internal Servlet Error:
> org.apache.jasper.JasperException: Unable to load class Mesto
> ..............
> Root cause:
> java.lang.ClassNotFoundException: Unable to load class Mesto
> ..............
>
> 2) Location of my JSP page mesto.jsp
> *******************************************
>
> My JSP page mesto.jsp is at directory /usr/adissys/pok_JSP/SB/vzor. This
> directory has (!) subdirectory WEB-INF/classes, where I have JavaBean
> Mesto.class.
>
> 3) Calling of my JSP page mesto.jsp from Internet Explorer 5.0
>
*********************************************************************
>
> I call my JSP page mesto.jsp with HTTP address
> http://intax5:8080/pok_JSP/SB/vzor/mesto.jsp.
>
> 4) Defining of context /pok_JSP at server.xml
> **************************************************
>
> My context /pok_JSP is defined (at server.xml) correctly (I hope):
>
> <Context path="/pok_JSP"
> docBase="/usr/adissys/pok_JSP"
> debug="9"
> reloadable="true" >
> </Context>
>
> 5) JavaBean class Mesto.java
> *********************************
> The class Mesto.java is this:
>
> public class Mesto implements Cloneable {
> int id_mes;
> String naz_mes;
> public void setId_mes (int id_mes) { this.id_mes = id_mes; }
> public int getId_mes () { return id_mes; }
> public void setNaz_mes (String naz_mes) { this.naz_mes = naz_mes; }
> public String getNaz_mes () { return naz_mes; }
> public Mesto () {}
> public Mesto (int id_mes,
> String naz_mes) { this.id_mes = id_mes;
> this.naz_mes = naz_mes; }
> protected Object clone ()
> throws CloneNotSupportedException { return super.clone(); }
> }
>
> 6) Possible cause of problem
> ********************************
>
> Is possible, that this problem is caused by absence of package directive
at
> Mesto.java?
> But, I repeat, when I tested the same mesto.jsp (and the same Mesto.java)
> under Windows 95 + JDK 1.2.2, all worked very nice! I do not want to have
> package here, but if i will be necessary, I would be accept that fact, of
> course.
>
> I think, that Mesto.class must be find, when Mesto class is located at
> subdirectory WEB-INF/classes under directory pok_JSP. The text
> "ContextManager: Adding context Ctx( /pok_JSP )" was displayed during
> started of Tomcat (I think, it is correct).
>
> Thank you for your any sugestions!
>
> Mirek Subrt