tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mirek.Su...@intax.cz
Subject JavaBean at JSP
Date Mon, 23 Oct 2000 07:46:10 GMT
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





Mime
View raw message