Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError while Retrieving data

 
Anand Arasu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Situation:
--------------
We are loading the page text(Text to be displayed in HTML) from database and the Init Servlet has the code for retrieving the text. Hence while publishing the ear file, the data are prepopulated to the JVM and based on request the page text are displayed.

System Details :
--------------------
Database - Oracle 10G
IDE - RAD 6.0
jdk - 1.4
Ram - 1 GB
OS - Win XP

And the table has 2 varchar2 and 3 Clob datatypes..

Problem:
---------
But when we try to publish it twice or thrice it gives the OutOfMemoryError and gives the below Exception.


[10/26/06 19:25:22:187 IST] 0000009e ServletWrappe E SRVE0100E: Did not realize init() exception thrown by servlet InitServerServlet: java.lang.OutOfMemoryError
at oracle.jdbc.driver.T4C8TTIClob.read(T4C8TTIClob.java(Compiled Code))
at oracle.jdbc.driver.T4CConnection.getChars(T4CConnection.java(Compiled Code))
at oracle.sql.CLOB.getChars(CLOB.java(Inlined Compiled Code))
at oracle.jdbc.driver.OracleClobReader.needChars(OracleClobReader.java(Compiled Code))
at oracle.jdbc.driver.OracleClobReader.read(OracleClobReader.java(Compiled Code))
at java.io.Reader.read(Reader.java(Inlined Compiled Code))
at oracle.jdbc.driver.ClobAccessor.getString(ClobAccessor.java(Compiled Code))
at oracle.jdbc.driver.T4CClobAccessor.getString(T4CClobAccessor.java(Compiled Code))
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java(Compiled Code))
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java(Compiled Code))
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getString(WSJdbcResultSet.java(Compiled Code))
at com.aaaa.aaaaa.Language.getText(LookupDAO.java:106)
at com.aaaaa.aaaaa.LookupDBLayer.getText(LanguageLookupDBLayer.java:41)
at com.aaaaa.aaaaa.LookupBundle.loadBundle(LanguageLookupBundle.java:28)
at com.aaaaa.aaaaa.existingmerchant.jsf.utils.InitServerServlet.initLanguageData(InitServerServlet.java:77)
at com.aaaaa.aaaaa.existingmerchant.jsf.utils.InitServerServlet.init(InitServerServlet.java:34)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:262)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1319)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:84)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:745)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:493)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:379)
at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:114)
at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:127)
at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:776)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:729)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:140)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:360)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1019)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1028)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:538)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:724)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:683)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1366)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1012)
at mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke(InvokerMBeanServerInterceptor.java:233)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:128)
at mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke(SecurityMBeanServerInterceptor.java:86)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:128)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:128)
at mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invoke(ContextClassLoaderMBeanServerInterceptor.java:167)
at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java:1249)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:901)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:817)
at com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:196)
at com.ibm.ws.management.application.sync.StartDeploymentTask.fullAppUpdate(StartDeploymentTask.java:92)
at com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:81)
at com.ibm.ws.management.application.sync.AppBinaryProcessor$AppBinThread.run(AppBinaryProcessor.java:631)
at com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcess(AppBinaryProcessor.java:408)
at com.ibm.ws.management.application.sync.AppBinaryProcessor._onChangeCompletion(AppBinaryProcessor.java:330)
at com.ibm.ws.management.application.sync.AppBinaryProcessor$2.run(AppBinaryProcessor.java:302)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.ibm.ws.management.application.sync.AppBinaryProcessor.onChangeCompletion(AppBinaryProcessor.java:296)
at com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1653)
at com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1211)
at com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189)
at com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:482)
at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1730)
at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1676)
at com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:455)
at com.ibm.ws.management.application.task.ConfigRepoHelper.removeWorkSpace(ConfigRepoHelper.java:107)
at com.ibm.ws.management.application.RedeploymentManager.doCleanup(RedeploymentManager.java:243)
at com.ibm.ws.management.application.RedeploymentManager.appEventReceived(RedeploymentManager.java:187)
at com.ibm.ws.management.application.RedeploymentManager.handleNotification(RedeploymentManager.java:210)
at com.ibm.ws.management.event.ListenerInfo$1.run(ListenerInfo.java:125)
at com.ibm.ws.security.auth.distContextManagerImpl.runAs(distContextManagerImpl.java:2504)
at com.ibm.ws.security.auth.distContextManagerImpl.runAsSpecified(distContextManagerImpl.java:2398)
at com.ibm.ws.management.event.ListenerInfo.handleNotification(ListenerInfo.java:143)
at com.ibm.ws.management.event.NotificationDispatcher$DispatchANotificationToAListener.run(NotificationDispatcher.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)

Kindly let me know if i could have a work around for this....

Thanks and Regards,
Anand
 
trycatch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we can control the amount of memory that is initially reserved for the heap and the max value for the heap...
>java -Xms_m -Xmx_m
ms-->initially allocated memory
mx-->if ms is not enough mx increase the heap.....
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But when we try to publish it twice or thrice


Exactly what do you mean by that?

Are you trying to change the content while the servlet is still running?
If so, how?

Bill
 
Anand Arasu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
quote:
--------------------------------------------------------------------------------
But when we try to publish it twice or thrice
--------------------------------------------------------------------------------

Thanks for your time William

What we do is, when we publish it once it retrives the PageText for selected language(Say English), and when we change the language(to Spanish) it hits the DB and retrives the second set of data and at that time it gives OutOfMemoryError.

Is that related to use of resuleset.getClob method which gives a String[] project in oracle 10G ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could just be that your app requires more memory than the default 64k that a JVM allots for itself.
It sounds like you have enough for one of the languages but no more.

Try increasing your heap space allocation.
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When you retrieved the second set of data from the database, do your application clear the previous set or it will collectively keep all loaded data as cache? If memory is a constraint here, maybe you need to purge some of the caches and let GC clean up the memory. Or else seems like increasing the JVM heap size is the way to go.

Hope this helps. Cheers
 
Anand Arasu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We always nullify the resultset everytime..but even then error was thrown..

But we got a temporary work around..we altered the table from clob to varchar2(4000) and from then the error is not thrown...

Technically, couldn't explain how it happened...

Thanks and Regards,
Anand
 
chnaresh Cheedella
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I also faced that problem.

But I am using eclipse.

I have changed the virtual memory size of the jre as

-Xms512m -Xmx512m -Xss256k

to change that one you need to go in eclipse

window->preference->java->installedjre->edit


after changed that one I have not got that problem again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic