views:

487

answers:

1

I'm using the maven-jetty-plugin to run a Spring application. Initially the datasource was declared inside Spring. Due to external constratins, I've moved it to JNDI. The jetty-env.xml section I use for local development is:

<New id="dataSource" class="org.mortbay.jetty.plus.naming.Resource">
 <Arg></Arg>
 <Arg>jdbc/DataSource</Arg>
 <Arg>
  <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
   <Set name="driverClass">org.hsqldb.jdbcDriver</Set>
   <Set name="jdbcUrl">jdbc:hsqldb:file:target/file.db;shutdown=true
   </Set>
   <Set name="user">sa</Set>
   <Set name="password"></Set>
   <Set name="initialPoolSize">3</Set>
   <Set name="maxPoolSize">5</Set>
   <Set name="numHelperThreads">2</Set>
   <Set name="breakAfterAcquireFailure">true</Set>
  </New>
 </Arg>
</New>

Unfortunately I can't see to be able to restart the web context, since the database remains locked. Any thoughts on what I'm doing wrong here?

A: 

Are you allowing a clean shutdown of the server? I.e. how are you 'running' your development environment? How are you shutting it down?

If you're running it under Eclipse, you may be given an opportunity to press 'enter' on the console, which will cleanly shutdown your system and cause the db to release it's file lock. However if you're 'killing' your environment (clicking the red stop button in Eclipse, or perhaps ctrl-c from the console), HSQLDB may not have a change to release it's file -based lock.

If you're doing this all for development - have you given consideration to running an in-memory database? It makes development and automated unit testing much faster!

Antony Stubbs