drwho
unread,Jun 8, 2010, 5:06:11 AM6/8/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Lift
hi,
we are using the liftweb mapper stuff for our application and are
using scala specs for testing. so far we've been using maven to drive
the build and test cycle but i'd like to switch to sbt as that seems
to be a bit more nimble on its feet.
one problem that i'm running into with sbt is the following:
- in the specs for our models we have code like this:
val boot = new Boot
"XXX" should {
// do this initially
doFirst {
boot.dbSetup
boot.dbCleanUp
}
// do this after each example
doAfter {
boot.dbCleanUp
if (tempFile != None) {
tempFile.get.delete
tempFile = None
}
}
doLast {
boot.dbTearDown
}
with Boot.dbSetup containing this:
if (!DB.jndiJdbcConnAvailable_?) {
val v =
new StandardDBVendor(Props.get("db.driver") openOr
"org.apache.derby.jdbc.EmbeddedDriver",
Props.get("db.url") openOr
"jdbc:derby:data/db;create=true",
Props.get("db.user"),
Props.get("db.password"))
vendor = Full(v)
LiftRules.unloadHooks.append(v.closeAllConnections_!
_)
DB.defineConnectionManager(DefaultConnectionIdentifier, v)
}
Schemifier.schemify(true, Log.infoF _, ...)
and Boot.dbCleanUp containing a bunch of .bulkDelete_!!
(NotNullRef(XXX.id) calls to clean out the tables,
and Boot.dbTearDown containing:
def dbTearDown: Unit = {
vendor foreach (_.closeAllConnections_!)
}
- each spec that uses DB stuff has the doFirst/doAfter/doLast code in
it.
- running the specs via "mvn test" works just fine and running them
again via "mvn test" also works just fine.
- running the specs from sbt with "test" works fine the first time
round, but fails with
java.sql.SQLException: Failed to start database 'data/db', see the
next exception for details.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.impl.jdbc.EmbedConnection40.<init>(Unknown
Source)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at net.liftweb.mapper.StandardDBVendor.createOne(DB.scala:1015)
at net.liftweb.mapper.ProtoDBVendor$class.newConnection(DB.scala:
1070)
at net.liftweb.mapper.StandardDBVendor.newConnection(DB.scala:1004)
at net.liftweb.mapper.DB$$anonfun$6$$anonfun$apply$3.apply(DB.scala:
134)
at net.liftweb.mapper.DB$$anonfun$6$$anonfun$apply$3.apply(DB.scala:
134)
at net.liftweb.common.EmptyBox.or(Box.scala:378)
at net.liftweb.mapper.DB$$anonfun$6.apply(DB.scala:134)
at net.liftweb.mapper.DB$$anonfun$6.apply(DB.scala:134)
at net.liftweb.common.Full.flatMap(Box.scala:336)
at net.liftweb.mapper.DB$.newConnection(DB.scala:134)
at net.liftweb.mapper.DB$.getConnection(DB.scala:230)
at net.liftweb.mapper.DB$.use(DB.scala:575)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:68)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:51)
at bootstrap.liftweb.Boot.dbSetup(Boot.scala:81)
...
Caused by: java.sql.SQLException: Failed to start database 'data/
db', see the next exception for details.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
... 91 more
Caused by: java.sql.SQLException: Java exception: ':
java.nio.channels.OverlappingFileLockException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
... 88 more
the second time round.
any idea what we might be doing wrong?