• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

weird non-deterministic problem

Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
I AM MIGHTY! Especially when I hold this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic