You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wilson Snook <op...@planman91.fsnet.co.uk> on 2003/01/14 08:24:00 UTC

HTTP Status 500: Cannot find any information on property myProperty in a bean of type 'myPackage.MyBean'


 I am a new user of Tomcat (4.1.18) under Win2K.  I have the following
problem (standalone development) with a test web application (single page
using a bean: action is to reload itself updated by bean):

I have this webapp directory structure (I've simplified the contents for
readability):

     %TOMCAT_HOME%/webapps/core
                         -->/index.jsp, etc.
                         -->/WEB-INF/classes/coreBeans/FormBean.class

 FormBean.java has the package declaration package coreBeans.

 I've added the following context to server.xml:

     <Context path="/core" docBase="core" debug="0" reloadable="true"
 crossContext="true" />

 As I understand it Tomcat should now automatically locate my bean class -
but it doesn't.  From http://localhost:8080/core I get HTTP Status 500 and
the following error:

     org.apache.jasper.JasperException: Cannot find any information on
 property 'uName' in a bean of type 'coreBeans.FormBean'"

 I followed a tutorial on the web and created another application (that used
a servlet) - same result, but eventually I made it work by amending the
entry in the web.xml under the WEB-INF directory to map the servlet.
However, I don't think I can use this trick on beans.

 If I shove the webapp under the webapps/examples/jsp folder and put the
bean
under the associated WEB-INF/classes directory it works, so I know that the
bean has compiled and the JSP page is error free.

 It seems to me that my setup of Tomcat is not configured to find the
classes
and libraries of a web application properly.  I'm baffled and I'd appreciate
any help.

> ******** index.jsp **************
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>  <title>JSP development site: <%= application.getServerInfo() %></title>
>
>  <!-- style sheet (remove to external css file) -->
>  <style type="text/css">
>  <!--
>
>  body {
>   color: #000000; background-color: #f0f0f0;
>       font-family: verdana, arial, helvetica, sans-serif
>  }
>  table {
>   border-collapse: collapse;
>  }
>  table.bordered {
>   border: 1px 1px 1px 1px;
>   border-style:solid;
>  }
>  td.head {
>   font-family: arial, verdana, helvetica, sans-serif;
>   font-size: 1.2em;
>   padding: 3 3 3 3;
>  }
>  td {
>   font-family: verdana, arial, helvetica, sans-serif;
>   font-size: 0.8em;
>   padding: 3 3 3 3;
>  }
>  .LgnBtn      { font-size: 75% }
>
>  -->
>  </style>
>
>  <!-- focus on login box -->
>  <script>
>  <!--
>  function SetLoginFocus() {
>     var elem = document.forms ? document.forms.login : false;
>   elem = elem && elem.elements ? elem.elements["userName"] : false;
>     if (elem) {
>       elem.focus();
>       elem.select();
>     }
>  }
>  //-->
>  </script>
>
> </head>
>
> <body onload="SetLoginFocus()">
>
> <!-- encase the HTML in a form -->
> <form name="login" action="/core/index.jsp" method="post">
>
> <!-- header -->
> <table width="100%">
>  <tr >
>   <td class="head" style="color:white; background-color: #000099;
> font-weight: bold">JSP development site</td>
>  </tr>
>  <tr>
>   <td style="background-color: #CCCCFF">This site is under construction.
> When completed it will demonstrate a simple database application using JSP
> technology and Java servlets.  The database employed in the application is
> planned to be <b>Oracle<i>8i</i> Personal Edition.</b>  This site is
> strictly for demonstration purposes only.  It has no commercial
> function.</td>
>  </tr>
> </table>
> <br>
>
> <!-- acknowledgement -->
> <table class="bordered" style="border-color: #AACCCC" bgcolor="#FFFFFF"
> width="100%">
>  <tr>
>   <td style="font-size:0.7em">I gratefully acknowledge the assistance and
> encouragement given to me by XXXXX in the development of this site.</td>
>  </tr>
> </table>
> <br>
> <!-- description and log-in table -->
> <table class="bordered" style="border-color:
> #CCCCFF;border-collapse:separate" width="85%" align="center">
>  <tr>
>   <td class="head" style="background-color:#CCCCFF;" width="60%">Database
> design</td>
>   <td class="head" style="background-color:#CCCCFF" width="40%">Log
> in</td></td>
>  </tr>
>  <tr valign="top">
>   <td style="background-color: white"><br>The database comprises two
simple
> tables:
>    <div style="background-color:#CCCC99">
>    <dl>
>     <dt><b>&nbsp;company</b></dt>
>      <dd>ID (primary key)</dd>
>      <dd>name</dd>
>      <dd>sector</dd>
>      <dd>country</dd>
>     <br><br>
>     <dt><b>&nbsp;report</b><dt>
>      <dd>R_ID (primary key)</dd>
>      <dd>start_date</dd>
>      <dd>end_date</dd>
>      <dd>analyst_name</dd>
>      <dd>R_FK (foreign key referencing <i>company.ID</i>)</dd>
>    </dl>
>    </div>
>    Simple (but nonetheless representative) queries and transactions on
these
> tables are implemented on this site.
>   </td>
>   <td style="background-color: white">
>    <br>
>    <p align="right" style="position:relative;margin-right:4em">User name:
> <input size="20" name="uName" value=""><br><br>
>    Password: <input type="password" size="20" name="incomingPassword"
> value=""><br><br>
>    <input type="submit" name="authenticate" value="Login"
> class="LgnBtn"></p>
>    <p>Unless you have been notified of your <i>user name</i> and
> <i>password</i> by the administrator you will not be able to proceed past
> this point.</p>
>    </p>If you would like to access this site then please contact the <a
> href="xxx">administrator</a>.</p>
>   </td>
>  </tr>
> </table>
> </form>
>
> </body>
> </html>
>
> <%-- Create the bean only when the form is posted --%>
> <%
> if (request.getMethod().equals("POST")) {
> %>
>  <jsp:useBean id="formHandler" class="coreBeans.FormBean" />
>   <%-- provide a setProperty tag and ensure that the setter methods are
> invoked via
>   introspection --%>
>   <jsp:setProperty name="formHandler" property="*" />
>  </jsp:useBean>
>  <% if (formHandler.isOKPassword()) { %>
>   <hr>
>   <span>
>   Welcome, <jsp:getProperty name="formHandler" property="uName" />.  You
are
> now logged into the site.
>   </span>
>  <% } else { %>
>   <hr>
>   <span style="color:red">
>   ERROR: login failed, <jsp:getProperty name="formHandler"
property="uName"
> />!
>   </span>
>  <%
>  }
>  %>
> <%
> } //end request check if
> %>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>