Hi,
I am implemention my DB using JPA. I have around 20 methods in my DAO class to get/insert/update/delete records from Tables.
Please find my sample implementation below.
**************************************
createEntityManager("dbSettlementReporting");
ArrayList listProcess = new ArrayList();
try {
String sqlProcess = "select processCode, longDesc from ProcessCode";
listProcess = (ArrayList) em.createNativeQuery(sqlProcess, ProcessBean.class).getResultList();
}catch (RuntimeException e) {
e.printStackTrace();
log.error("Fatel Error Occurred - Please contact Administrator"+e.getStackTrace()); // or display error message
return null;
} catch(Exception e) {
e.printStackTrace();
log.error("Error Occurred - Please contact Administrator"+e.getStackTrace()); // or display error message
return null;
}finally {
closeEntityManager();
}
Problem:
*******
When i run application it was fine for sometime. When i start doing multiple transaction it throw "Out of Memory Error" in the server.
Please find the Error Message below.
******************************
Quote:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by:
java.lang.OutOfMemoryError: PermGen space
2008-01-31 15:00:37,576 TRACE [org.jboss.web.tomcat.security.RunAsListener] AdjustmentClient, runAs: null
2008-01-31 15:00:37,576 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/ADJClient].[AdjustmentClient]] Servlet.service() for servlet AdjustmentClient threw exception
java.lang.OutOfMemoryError: PermGen space.
I am closing both emf and em in finally block of every method.
But i am not closing the transaction which i have used in some of the methods.
Do we really need to close emf and em after every method?
DB : SQL Server
WebServer : JBoss 4.2.2
Framework : Spring.
Kindly help me.
Thanks,
Lakshmi Narayanan.