File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

weird non-deterministic problem

 
Mirko Froehlich
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have discovered a very weird, non-deterministic problem in a JSP page. The page is fairly simple, it mainly uses one JavaBean that gets some data from an Oracle database. The bean is instantiated with a usebean tag, and then a couple of setters and other methods are executed on it. When I run it on my personal machine, everything works fine. However, on the Unix QA and production servers, the bean behaves very weird. The JSP pages uses the following code to iterate over some data:
<%
String currentHeader = "";
for (int i = 2; i <= comp.getNumCols(); i++) {
currentHeader = comp.getHeader(i);
// do stuff with the header
}
%>
Don't ask why we are iterating from index 2 to the number of columns, but this is correct. For some reason, if we print out the value of "i" in getHeader, it prints out some very large negative integer, instead of the numbers 2 through the number of columns (typically < 10). This in turn causes an ArrayIndexOutOfBoundsException in the bean. This should never be able to happen. We added some debug output to dump the value of "i" in the loop on the JSP page, and it outputs the correct values. The weird thing is that this also FIXES THE PROBLEM! Consequently, removing this debug output re-introduces the problem again.
This reminds me very much of a problem I had in a C++ program a few years ago, which was caused by some kind of memory corruption. As in our case, adding debug output sometimes fixed the problem... However, as far as I know, something like this should never be able to happen in Java. The only thing that might happen in Java if objects are not correctly garbage collected is a memory leak, but that is not the case. This happens even after restarting the application server, no matter if this is the first page that gets hit or if we wait a while.
BTW: We are using Netscape Enterprise Server and Bluestone Sapphire UBS as the application server.
Any ideas???
-Mirko
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic