• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Memory Heap Exception

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using dbutils to connect to data base using following resource in context.xml

<Context path="/SFE" reloadable="true">
<Resource name="jdbc/salesForce" auth="Container" type="javax.sql.DataSource"
connectionProperties="databasename=salesforcerpt_dev"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
maxActive="10"
maxIdle="-1"
maxWait="5000"
initialSize="10"
password="salesforce"
removeAbandoned="true"
url="jdbc:sqlserver://myauvwv00100430:1433"
username="salesforceuser"
validationQuery="select 1"
/>
</Context>


now my application is throwing java.sql.SQLException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:42,174,756. JVM total memory size:1,069,678,592.

please could you help me out
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What heap size is your JVM using? Have you tried increasing this?
 
anil katta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.sql.SQLException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:42,174,756. JVM total memory size:1,069,678,592.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. And have you tried increasing the available heap?
 
anil katta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is lot of heap size rite.. please let me know how to increase a web application heap size
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1Gb for a web applicaton? It depends on the load its under, but I wouldn't consider that that big. If you are not doing much with the application and its hitting this sort of limit you probably have to go an investigate what your application is doing (are you caching loads of stuff in the session? are you returning huge result sets? Are you releasing JDBC resopurces when you don't need them? etc. )

Assuming its a Sun JVM, this will tell you how to increase heap size.
 
anil katta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes I'm returning Huge resultset..
in this what i need to do could you please guide me...
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Huge result sets usually don't really have a place in web applications; are you really expecting users to wade through tens of thousands of results? Or just look through the first twenty and search again?

The usual way to handle this is to use paging. Have a search through this forum, there are hundreds of examples.
 
anil katta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is already a paging functionality included for the same. but still it comes.. could you please guide me for other alternatives

I tried with
<Context path="/SFE" reloadable="true">
<Resource name="jdbc/salesForce" auth="Container" type="javax.sql.DataSource"
connectionProperties="databasename=salesforcerpt_dev"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
maxActive="10"
maxIdle="-1"
maxWait="1000"
initialSize="10"
password="salesforce"
removeAbandoned="true"
url="jdbc:sqlserver://myauvwv00100430:1433"
username="salesforceuser"
validationQuery="select 1"
/>
</Context>

keeping maxIdle to -1 and inserted a initialiSize to 10.. it is not giving any exception so called Java memory heap but some times socket connection is not getting

java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:531)
at org.apache.jk.common.JkInputStream.endMessage(JkInputStream.java:121)
at org.apache.jk.core.MsgContext.action(MsgContext.java:304)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.coyote.Response.finish(Response.java:305)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:276)
at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:104)
at org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader.writeResource(MyFacesResourceLoader.java:244)
at org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader.serveResource(MyFacesResourceLoader.java:217)
at org.apache.myfaces.renderkit.html.util.DefaultAddResource.serveResource(DefaultAddResource.java:606)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:128)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)


Could you please guide me Paul??
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

anil katta wrote:yes I'm returning Huge resultset..
in this what i need to do could you please guide me...

Huge ResultSets usually don't take lots of memory, except if you define a large fetch size.

It is when you put each record of that huge ResultSet in a huge collection that it would result in Heap issues.

And yes - Huge ResultSets are typically useless in most applications. Refine your sql conditions, so that the filtering is done in the database.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys i needed you arer help i want create a combobox in that item will fatch from database table then
when i was select any item and click on button that time that item related data disply me in Table
 
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic