This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Out of Memory Exception in Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Out of Memory Exception in Websphere" Watch "Out of Memory Exception in Websphere" New topic
Author

Out of Memory Exception in Websphere

poornima karanth
Greenhorn

Joined: Feb 22, 2004
Posts: 13
Hi,
We have a peculiar problem while running a Search Service.
The different components involved are given below:
Struts Controller-> JSP Page -> EJB Stateless Session Bean -> Java Class (DAO)-> Database.
When a user clicks on the 'Search' button, the Search needs to fetch 10,000 records at a time. The request is serviced in the above manner and the resultset is displayed through a JSP Screen. Pagination Logic is built in the query so that it retrieves a partial resultset (ie first 10,000, next 10,000 etc)
However when the user clicks on the 'Next' Button, on the result screen, an Out of Memory Exception is thrown by the Bean. The Heap size is set to maximum. Note there is no SQL Exception occuring, the error occurs when the EJB has to send the resultset to the jsp.
Any Ideas as to why this happens?
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 125
Hi Poornima,
This could be happenning if there is an recursive loop in your logic somewhere...or if there is any cyclic reference between two objects check that. otherwise I dont see any problem...
you dont need to start to fetch the next 10,000 immediately till the traversal of the first 10,000 records are over, and more over may be you need to GC the first 10000 records to fetch the new ones...??
poornima karanth
Greenhorn

Joined: Feb 22, 2004
Posts: 13
Thanks Rajanikanth,
We did a code check for memory leaks in the code. And found the following.
The Data in each column is huge, (the biggest one is around 500 chars in a column). So while setting the data for this column in every record, the functionality required replacing a particular character by another before display. This was being done in the DAO before populating the ArrayList Object.
We pushed this code to the Query (using Replace function) & now it works fine.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Out of Memory Exception in Websphere
 
Similar Threads
Performance tunning using J2EE
design issue...
Releasing objects on multiple requests
how to tell when ie 7 is done rendering?
Returning ResultSet from servlet to jsp ->NullPointerException