Hi,

Thanks for replying. I was looking through the code trying to find
multi-threading problems (like Bob said).

So, I decided to post some code fragments in order to show to you how
stupid these errors are...

<jsp:useBean id = "ticket" class = "com.mycompany.Ticket"/>

<%
  ticket.setAttribute("code", request.getParameter("ticketCode"));
  ticket.loadElement();
  ...
%>

The exception rises in the line "ticket.loadElement()". What we are
doing is a simple db select to retrieve some data, and then we are using
it in order to set the object fields.

The exception (a custom one) tells that the code has not been properly
setted, so the loadElement() method could not be executed...

It's insane, because as I shown, I'm setting it one line before (like
the problem that Frank had), and again, this code works well under light
pressure.

This is the reason that I told that tomcat was losing request
parameters.

By default, the jsp isThreadSafe="true". So I think that it could not be
changed by another request...   

Looking through the copiled jsp, I found that my bean becomes this:

com.mycompany.Ticket ticket = null;
synchronized (pageContext) {
  ticket = (com.mycompany.Ticket) pageContext.getAttribute("ticket",
PageContext.PAGE_SCOPE);
  if (ticket == null){
    try {
      ticket = (com.mycompany.Ticket)
      java.beans.Beans.instantiate(this.getClass().getClassLoader(),
"com.mycompany.Ticket");
    } catch (ClassNotFoundException exc) {
      throw new InstantiationException(exc.getMessage());
    } catch (Exception exc) {
      throw new ServletException("Cannot create bean of class " +
"com.mycompany.Ticket", exc);
    }
    pageContext.setAttribute("ticket", ticket, PageContext.PAGE_SCOPE);
  }
}

I am trying to avoid changes, but I think that I will explicit call
isThreadSafe on the top of the page and also change the scope for
REQUEST_SCOPE...

Just to let you know...

TIA,

Bob


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to