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 Kamesh Parameswaran <ka...@cisco.com> on 2008/12/06 11:26:49 UTC

Urgent : Problem in booting up the database using Derby

Hello All,
 
I'm suffering a weird kind of a problem while running my JUnit Test Cases
against a database which uses derby as an engine.
Once after each test case gets completed I'm shutting down the database and
derby using the following piece of code
 
DriverManager.getConnection("jdbc:derby:;shutdown=true");
 
I'm running a batch of test cases at a fly using the JUnit option available
in Apache ANT, from Command Line mode. There are eleven test cases in my
Batch. Since my test cases make use of hibernate to boot up derby as well as
the database, I don't have to worry about starting it up. It is done in
embedded mode. I have to be worried about shutting down the derby instance
and db properly. The problem is, the first 3 test cases start up and
shutdown the derby and db properly, but when the fourth test case tries to
boot up the db I'm getting the following error ,
 
============================================================================
=======================================
2008-12-06 05:24:47.154 GMT
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,mai
n] Cleanup action starting
java.sql.SQLException: Failed to start database <db-name>., see the next
exception for details.
 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.EmbedConnection.bootDatabase(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
 at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
 at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
 at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
 at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
 at
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataS
ource.java:81)
 at
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(Wrap
perConnectionPoolDataSource.java:96)
 at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0Pool
edConnectionPool.java:89)
 at
com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool
java:665)
 at
com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResourcePool.j
ava:32)
 at
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourceP
ool.java:1204)
 at
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolA
synchronousRunner.java:368)
Caused by: java.sql.SQLException: Another instance of Derby may have already
booted the database<db-name>..
 at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
 at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
 ... 13 more
Caused by: ERROR XSDB6: Another instance of Derby may have already booted
the database <db-name>.
 at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
 at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB
(Unknown Source)
 at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown
Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unk
nown Source)
 at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown
Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
 at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
 at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
 at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
 at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
 at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
 at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
 at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
 at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
 at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
Source)
 at
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unkn
own Source)
 at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartServi
ce(Unknown Source)
 at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Un
known Source)
 at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknow
n Source)
 ... 13 more
 
============================================================================
========================================
 
 
 
 
But the third test case has shutdown the db as well as the derby.. The
hibernate log shows,
 
2008-12-06 10:55:52,169 ERROR [main] (JDBCExceptionReporter.java:78) -
Connections could not be acquired from the underlying database!
 
 
 
I've totally no idea about what is going inside the derby. If it is able to
start it up and shut it down for three consecutive times then why its not
able to do the same for the upcoming runs. The starting up and shutting down
is done internally in the test case , and the test cases are run in a batch
mode using JUnit. So no way I'm stopping the tests in the middle. Derby and
database have to be started up and shutdown 11 times consecutively since
I've 11 cases in my JUnit task. If anyone could shed some lights on the
issue it'd be helpful for me to proceed further.
 
 
Thanks in Advance,
 
Kamesh P G.

RE: Urgent : Problem in booting up the database using Derby

Posted by Kamesh Parameswaran <ka...@cisco.com>.
Oystein,

Yes, exactly that is the point which I wanted. It shuts down the entire
Derby system(Derby Engine+Database) thrice, but it fails to do so from the
4th test case and further on. Obviously resulting in the exceptions.

Kamesh.

-----Original Message-----
From: Oystein.Grovlen@Sun.COM [mailto:Oystein.Grovlen@Sun.COM] 
Sent: Saturday, December 06, 2008 10:34 PM
To: Derby Discussion
Cc: kaparame@cisco.com
Subject: Re: Urgent : Problem in booting up the database using Derby



Emmanuel Cecchet wrote:
> Kamesh,
> 
>> I'm suffering a weird kind of a problem while running my JUnit Test 
>> Cases against a database which uses derby as an engine.
>> Once after each test case gets completed I'm shutting down the 
>> database and derby using the following piece of code
>>  
>> DriverManager.getConnection("jdbc:derby:;shutdown=true");
> Are you not supposed to provide the database name in the URL? It looks 
> like it is missing here.
> 

No, if you do not specify a database, all booted databases and the database
engine will be shut down.

--
Øystein


Re: Urgent : Problem in booting up the database using Derby

Posted by Øystein Grøvlen <Oy...@Sun.COM>.

Emmanuel Cecchet wrote:
> Kamesh,
> 
>> I'm suffering a weird kind of a problem while running my JUnit Test 
>> Cases against a database which uses derby as an engine.
>> Once after each test case gets completed I'm shutting down the 
>> database and derby using the following piece of code
>>  
>> DriverManager.getConnection("jdbc:derby:;shutdown=true");
> Are you not supposed to provide the database name in the URL? It looks 
> like it is missing here.
> 

No, if you do not specify a database, all booted databases and the 
database engine will be shut down.

--
Øystein


RE: Urgent : Problem in booting up the database using Derby

Posted by Kamesh Parameswaran <ka...@cisco.com>.
Hi All,

I solved my problem. At some point of time the instance of Derby engine has
been zombified inside the JVM. Got it working right by shutting down the
entire Derby system.

Thanks to everyone who suggested their valuable inputs on this.

Kamesh 

-----Original Message-----
From: Emmanuel Cecchet [mailto:manu@frogthinker.org] 
Sent: Saturday, December 06, 2008 8:21 PM
To: Derby Discussion
Cc: kaparame@cisco.com
Subject: Re: Urgent : Problem in booting up the database using Derby

Kamesh,
 
> I'm suffering a weird kind of a problem while running my JUnit Test 
> Cases against a database which uses derby as an engine.
> Once after each test case gets completed I'm shutting down the 
> database and derby using the following piece of code
>  
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
Are you not supposed to provide the database name in the URL? It looks like
it is missing here.

Emmanuel
>  
> I'm running a batch of test cases at a fly using the JUnit option 
> available in Apache ANT, from Command Line mode. There are eleven test 
> cases in my Batch. Since my test cases make use of hibernate to boot 
> up derby as well as the database, I don't have to worry about starting 
> it up. It is done in embedded mode. I have to be worried about 
> shutting down the derby instance and db properly. The problem is, the 
> first 3 test cases start up and shutdown the derby and db properly, 
> but when the fourth test case tries to boot up the db I'm getting the 
> following error ,
>  
> ======================================================================
> =============================================
> 2008-12-06 05:24:47.154 GMT
> Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2
> ,5,main]
> Cleanup action starting
> *java.sql.SQLException: Failed to start database <db-name>., see the 
> next exception for details.
> * 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.EmbedConnection.bootDatabase(Unknown
> Source)
>  at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)  
> at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)  
> at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown 
> Source)  at org.apache.derby.jdbc.InternalDriver.connect(Unknown 
> Source)  at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown 
> Source)  at
> com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManage
> rDataSource.java:81)
>  at
> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnectio
> n(WrapperConnectionPoolDataSource.java:96)
>  at
> com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3
> P0PooledConnectionPool.java:89)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResour
> cePool.java:665)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResource
> Pool.java:32)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicRes
> ourcePool.java:1204)
>  at
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Threa
> dPoolAsynchronousRunner.java:368) *Caused by: java.sql.SQLException: 
> Another instance of Derby may have already booted the 
> database<db-name>..*  at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
>  at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source)  ... 13 more *Caused by: ERROR XSDB6: Another instance of 
> Derby may have already booted the database <db-name>.*  at 
> org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLo
> ckOnDB(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown
> Source)
>  at java.security.AccessController.doPrivileged(Native Method)  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOn
> DB(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)  
> at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startProviderServic
> e(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStar
> tService(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentServ
> ice(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(
> Unknown
> Source)
>  ... 13 more
>  
> ======================================================================
> ==============================================
>  
>  
>  
>  
> But the third test case has shutdown the db as well as the derby.. The 
> hibernate log shows,
>  
> *2008-12-06 10:55:52,169 ERROR [main] (JDBCExceptionReporter.java:78)
> - Connections could not be acquired from the underlying database!*
> **
> **
> **
> I've totally no idea about what is going inside the derby. If it is 
> able to start it up and shut it down for three consecutive times then 
> why its not able to do the same for the upcoming runs. The starting up 
> and shutting down is done internally in the test case , and the test 
> cases are run in a batch mode using JUnit. So no way I'm stopping the 
> tests in the middle. Derby and database have to be started up and 
> shutdown 11 times consecutively since I've 11 cases in my JUnit task.
> If anyone could shed some lights on the issue it'd be helpful for me 
> to proceed further.
>  
>  
> Thanks in Advance,
>  
> Kamesh P G.


--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu@frogthinker.org
Skype: emmanuel_cecchet


RE: Urgent : Problem in booting up the database using Derby

Posted by Kamesh Parameswaran <ka...@cisco.com>.
Emanuel,

I could see the database and the instance of Derby get shutting down. I've
tried by giving my database URL too. But the result is same though.
DriverManager.getConnection("jdbc:derby:;shutdown=true"); is used to
shutdown the entire system of Derby (Derby+Database). Please correct me If
I'm wrong. Because I've tried all the combinations and couldn't achieve the
result which I expect.

Thanks,
Kamesh

-----Original Message-----
From: Emmanuel Cecchet [mailto:manu@frogthinker.org] 
Sent: Saturday, December 06, 2008 8:21 PM
To: Derby Discussion
Cc: kaparame@cisco.com
Subject: Re: Urgent : Problem in booting up the database using Derby

Kamesh,
 
> I'm suffering a weird kind of a problem while running my JUnit Test 
> Cases against a database which uses derby as an engine.
> Once after each test case gets completed I'm shutting down the 
> database and derby using the following piece of code
>  
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
Are you not supposed to provide the database name in the URL? It looks like
it is missing here.

Emmanuel
>  
> I'm running a batch of test cases at a fly using the JUnit option 
> available in Apache ANT, from Command Line mode. There are eleven test 
> cases in my Batch. Since my test cases make use of hibernate to boot 
> up derby as well as the database, I don't have to worry about starting 
> it up. It is done in embedded mode. I have to be worried about 
> shutting down the derby instance and db properly. The problem is, the 
> first 3 test cases start up and shutdown the derby and db properly, 
> but when the fourth test case tries to boot up the db I'm getting the 
> following error ,
>  
> ======================================================================
> =============================================
> 2008-12-06 05:24:47.154 GMT
> Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2
> ,5,main]
> Cleanup action starting
> *java.sql.SQLException: Failed to start database <db-name>., see the 
> next exception for details.
> * 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.EmbedConnection.bootDatabase(Unknown
> Source)
>  at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)  
> at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)  
> at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown 
> Source)  at org.apache.derby.jdbc.InternalDriver.connect(Unknown 
> Source)  at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown 
> Source)  at
> com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManage
> rDataSource.java:81)
>  at
> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnectio
> n(WrapperConnectionPoolDataSource.java:96)
>  at
> com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3
> P0PooledConnectionPool.java:89)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResour
> cePool.java:665)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResource
> Pool.java:32)
>  at
> com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicRes
> ourcePool.java:1204)
>  at
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Threa
> dPoolAsynchronousRunner.java:368) *Caused by: java.sql.SQLException: 
> Another instance of Derby may have already booted the 
> database<db-name>..*  at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
>  at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source)  ... 13 more *Caused by: ERROR XSDB6: Another instance of 
> Derby may have already booted the database <db-name>.*  at 
> org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLo
> ckOnDB(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown
> Source)
>  at java.security.AccessController.doPrivileged(Native Method)  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOn
> DB(Unknown
> Source)
>  at
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unkno
> wn
> Source)
>  at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)  
> at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startProviderServic
> e(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStar
> tService(Unknown
> Source)
>  at
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentServ
> ice(Unknown
> Source)
>  at
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(
> Unknown
> Source)
>  ... 13 more
>  
> ======================================================================
> ==============================================
>  
>  
>  
>  
> But the third test case has shutdown the db as well as the derby.. The 
> hibernate log shows,
>  
> *2008-12-06 10:55:52,169 ERROR [main] (JDBCExceptionReporter.java:78)
> - Connections could not be acquired from the underlying database!*
> **
> **
> **
> I've totally no idea about what is going inside the derby. If it is 
> able to start it up and shut it down for three consecutive times then 
> why its not able to do the same for the upcoming runs. The starting up 
> and shutting down is done internally in the test case , and the test 
> cases are run in a batch mode using JUnit. So no way I'm stopping the 
> tests in the middle. Derby and database have to be started up and 
> shutdown 11 times consecutively since I've 11 cases in my JUnit task.
> If anyone could shed some lights on the issue it'd be helpful for me 
> to proceed further.
>  
>  
> Thanks in Advance,
>  
> Kamesh P G.


--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu@frogthinker.org
Skype: emmanuel_cecchet


Re: Urgent : Problem in booting up the database using Derby

Posted by Emmanuel Cecchet <ma...@frogthinker.org>.
Kamesh,
 
> I'm suffering a weird kind of a problem while running my JUnit Test 
> Cases against a database which uses derby as an engine.
> Once after each test case gets completed I'm shutting down the 
> database and derby using the following piece of code
>  
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
Are you not supposed to provide the database name in the URL? It looks 
like it is missing here.

Emmanuel
>  
> I'm running a batch of test cases at a fly using the JUnit option 
> available in Apache ANT, from Command Line mode. There are eleven test 
> cases in my Batch. Since my test cases make use of hibernate to boot 
> up derby as well as the database, I don't have to worry about starting 
> it up. It is done in embedded mode. I have to be worried about 
> shutting down the derby instance and db properly. The problem is, the 
> first 3 test cases start up and shutdown the derby and db properly, 
> but when the fourth test case tries to boot up the db I'm getting the 
> following error ,
>  
> ===================================================================================================================
> 2008-12-06 05:24:47.154 GMT 
> Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] 
> Cleanup action starting
> *java.sql.SQLException: Failed to start database <db-name>., see the 
> next exception for details.
> * 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.EmbedConnection.bootDatabase(Unknown 
> Source)
>  at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
>  at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
>  at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
>  at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>  at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
>  at 
> com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:81)
>  at 
> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:96)
>  at 
> com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:89)
>  at 
> com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:665)
>  at 
> com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResourcePool.java:32)
>  at 
> com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1204)
>  at 
> com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:368)
> *Caused by: java.sql.SQLException: Another instance of Derby may have 
> already booted the database<db-name>..*
>  at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source)
>  at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
>  ... 13 more
> *Caused by: ERROR XSDB6: Another instance of Derby may have already 
> booted the database <db-name>.*
>  at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown 
> Source)
>  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown 
> Source)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown 
> Source)
>  at 
> org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown 
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown 
> Source)
>  at 
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown 
> Source)
>  at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown 
> Source)
>  at 
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown 
> Source)
>  at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown 
> Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown 
> Source)
>  at 
> org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown 
> Source)
>  at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
>  at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
>  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown 
> Source)
>  at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown 
> Source)
>  at 
> org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown 
> Source)
>  ... 13 more
>  
> ====================================================================================================================
>  
>  
>  
>  
> But the third test case has shutdown the db as well as the derby.. The 
> hibernate log shows,
>  
> *2008-12-06 10:55:52,169 ERROR [main] (JDBCExceptionReporter.java:78) 
> - Connections could not be acquired from the underlying database!*
> ** 
> ** 
> ** 
> I've totally no idea about what is going inside the derby. If it is 
> able to start it up and shut it down for three consecutive times then 
> why its not able to do the same for the upcoming runs. The starting up 
> and shutting down is done internally in the test case , and the test 
> cases are run in a batch mode using JUnit. So no way I'm stopping the 
> tests in the middle. Derby and database have to be started up and 
> shutdown 11 times consecutively since I've 11 cases in my JUnit task. 
> If anyone could shed some lights on the issue it'd be helpful for me 
> to proceed further.
>  
>  
> Thanks in Advance,
>  
> Kamesh P G.


-- 
Emmanuel Cecchet
FTO @ Frog Thinker 
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu@frogthinker.org
Skype: emmanuel_cecchet