You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Amir Michail <am...@gmail.com> on 2008/11/29 08:03:39 UTC

out of memory even though process size is small

Hi,

jsvc virt size is only 339m even though I specified it to be 1800m:

export CATALINA_OPTS="-Xms1800m -Xmx1800m"

Could this out of memory problem be related to derby somehow?

java.sql.SQLException: The exception 'java.lang.OutOfMemoryError: Java
heap space' was thrown while evaluating an expression. at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source) at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown
Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown
Source) at com.chatbotgame.server.DB.executeQuery(DB.scala:47) at
...
javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
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:684)
at java.lang.Thread.run(Thread.java:595) Caused by:
java.sql.SQLException: Java exception: 'Java heap space:
java.lang.OutOfMemoryError'. at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source) at org.apache.derby.impl.jdbc.Util.javaException(Unknown
Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source) ... 31 more Caused by: java.lang.OutOfMemoryError: Java heap
space

Amir

-- 
http://b4utweet.com
http://chatbotgame.com
http://numbrosia.com
http://twitter.com/amichail

Re: procedure to upgrade or create an embedded database

Posted by Rick Hillegas <Ri...@Sun.COM>.
Brian Peterson wrote:
> I'm trying to figure out how to determine what connection parameters for an
> embedded database I should use when there might not be a database in place
> (so "create=true"), or there might be an older version already in place (so
> "upgrade=true"), or there might already be a database of the right version
> in place (so "create" or add nothing to the URL).
>
> I read that "upgrade" and "create" cannot both be specified in the
> connection URL. If I'm putting out a release of my application that uses the
> latest version of Derby (10.4) while a previous version used 10.2.2, what
> are the recommended steps for making the connection to the Derby database if
> one is already present? (Note that I have to handle this programmatically as
> part of the application startup.)
>
> Do I first try a URL with "create" and see if there's an error, and if so,
> follow up with a call with "upgrade"? Or do I have the procedure always use
> "upgrade" and follow up with a URL with "create" if it fail to make a
>   
Hi Brian,

Your first approach sounds good to me:

1) Bring up the database, specifying "create=true"

2) If you get the warning that the database already exists, then bring 
down the database and reboot it in upgrade mode

Regards,
-Rick
> connection?
>
> Brian
>
>
>
>   


Re: procedure to upgrade or create an embedded database

Posted by Donald McLean <dm...@gmail.com>.
It is reasonably easy to find out if the database exists in Java -
create a File object with the correct path. If "exists()" returns
false then create it, otherwise you can upgrade it.

Donald

On Sat, Dec 6, 2008 at 12:45 PM, Brian Peterson <pu...@verizon.net> wrote:
> I'm trying to figure out how to determine what connection parameters for an
> embedded database I should use when there might not be a database in place
> (so "create=true"), or there might be an older version already in place (so
> "upgrade=true"), or there might already be a database of the right version
> in place (so "create" or add nothing to the URL).
>
> I read that "upgrade" and "create" cannot both be specified in the
> connection URL. If I'm putting out a release of my application that uses the
> latest version of Derby (10.4) while a previous version used 10.2.2, what
> are the recommended steps for making the connection to the Derby database if
> one is already present? (Note that I have to handle this programmatically as
> part of the application startup.)
>
> Do I first try a URL with "create" and see if there's an error, and if so,
> follow up with a call with "upgrade"? Or do I have the procedure always use
> "upgrade" and follow up with a URL with "create" if it fail to make a
> connection?

-------------------------------------------------------------
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

procedure to upgrade or create an embedded database

Posted by Brian Peterson <pu...@verizon.net>.
I'm trying to figure out how to determine what connection parameters for an
embedded database I should use when there might not be a database in place
(so "create=true"), or there might be an older version already in place (so
"upgrade=true"), or there might already be a database of the right version
in place (so "create" or add nothing to the URL).

I read that "upgrade" and "create" cannot both be specified in the
connection URL. If I'm putting out a release of my application that uses the
latest version of Derby (10.4) while a previous version used 10.2.2, what
are the recommended steps for making the connection to the Derby database if
one is already present? (Note that I have to handle this programmatically as
part of the application startup.)

Do I first try a URL with "create" and see if there's an error, and if so,
follow up with a call with "upgrade"? Or do I have the procedure always use
"upgrade" and follow up with a URL with "create" if it fail to make a
connection?

Brian




Re: out of memory even though process size is small

Posted by Amir Michail <am...@gmail.com>.
On Sat, Nov 29, 2008 at 2:03 AM, Amir Michail <am...@gmail.com> wrote:
> Hi,
>
> jsvc virt size is only 339m even though I specified it to be 1800m:
>
> export CATALINA_OPTS="-Xms1800m -Xmx1800m"

Please ignore.  I fixed the memory problem by modifying the
/etc/init.d/tomcat5.5 script.

Amir

>
> Could this out of memory problem be related to derby somehow?
>
> java.sql.SQLException: The exception 'java.lang.OutOfMemoryError: Java
> heap space' was thrown while evaluating an expression. at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown
> Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
> Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
> Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
> Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
> Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown
> Source) at com.chatbotgame.server.DB.executeQuery(DB.scala:47) at
> ...
> javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
> 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:684)
> at java.lang.Thread.run(Thread.java:595) Caused by:
> java.sql.SQLException: Java exception: 'Java heap space:
> java.lang.OutOfMemoryError'. at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source) at org.apache.derby.impl.jdbc.Util.javaException(Unknown
> Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
> Source) ... 31 more Caused by: java.lang.OutOfMemoryError: Java heap
> space
>
> Amir
>
> --
> http://b4utweet.com
> http://chatbotgame.com
> http://numbrosia.com
> http://twitter.com/amichail
>



-- 
http://b4utweet.com
http://chatbotgame.com
http://numbrosia.com
http://twitter.com/amichail