Hi,
My primary issue is the hot redeploy on change feature of jetty-run
causes Lift to throw an exception. Doing a jetty-stop and then jetty-
run again also results in the same exception.
Details:
Scala: 2.9.0-1
Lift: 2.4-M3
sbt: 0.10.1
I've tested this issue on both Ubuntu 64bit and windows 7 64bit.
Example project demonstrating the issue:
https://github.com/jousby/squerylrecord_redeploy_issue
So in my lift app i was playing around with squerlyrecord and thought
the squerylrecord might be the main culprit here. However even when i
comment out the stuff to do with squerylrecord things still behave
strangely after a jetty-stop.
My exact error when i have the squerylrecord code in:
$ sbt
[info] Set current project to default-987a38 (in build file:/usr/dev/
scala/projects/personal/portfolio-manager/project/plugins/)
> jetty-run
2011-08-19 21:32:53.961:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
-- table declarations :
create table Trade (
id bigint not null primary key auto_increment,
tradeType int not null,
tradeDate timestamp not null
);
> jetty-stop
19/08 21:34:13.599 DEBUG n.l.http.LiftServlet - Destroyed Lift
handler.
> jetty-run
2011-08-19 21:38:46.264:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
19/08 21:38:53.650 ERROR n.l.h.p.HTTPProvider - Failed to Boot!
Your application may not run properly
java.sql.SQLException: No suitable driver found for
jdbc:h2:mem:potfolio-manager;DB_CLOSE_DELAY=-1
at java.sql.DriverManager.getConnection(DriverManager.java:640) ~[na:
1.6.0_22]
at java.sql.DriverManager.getConnection(DriverManager.java:200) ~[na:
1.6.0_22]
at bootstrap.liftweb.Boot$$anonfun$boot$3.apply(Boot.scala:28)
~[classes/:na]
at bootstrap.liftweb.Boot$$anonfun$boot$3.apply(Boot.scala:27)
~[classes/:na]
at org.squeryl.SessionFactory$.newSession(Session.scala:95)
~[squeryl_2.9.0-1-0.9.4.jar:na]
at org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:64)
~[squeryl_2.9.0-1-0.9.4.jar:na]
at net.liftweb.squerylrecord.RecordTypeMode
$.transaction(RecordTypeMode.scala:34) ~[lift-squeryl-
record_2.9.0-1-2.4-M3.jar:2.4-M3]
at bootstrap.liftweb.Boot.boot(Boot.scala:35) ~[classes/:na]
Things I've tried:
- Running VisualVM over the sbt session shows that after a jetty-
stop, rather than threads being cleaned up, lots of new threads
actually startup? In particular despite the log message saying
'Destroyed Lift handler.', a new thread called LiftDispatcher starts
up along with an ever increasing number or threads called 'pool-x-
thread-x' (x is a number).
- I've tried the following line to shutdown any squeryl stuff that
might be lying around post jetty stop:
LiftRules.unloadHooks.append(() =>
Session.currentSession.close)
- I've tried commenting out all the SquerylRecord code which stops
this exception, but the weird behaviour with threads starting up after
'jetty-stop' remains.
- Turning off hot redeploy (jetty scan dirs := Nil ) and using jrebel
instead. Same issue.
What I suspect:
- I've done something dumb with my Lift application setup so it is not
cleaning up things cleanly after shutdown/restart.
- The sbt web plugin is not being aggressive enough in regards to
kiling threads when jetty-stop is called?
Any more thoughts on how to resolve would be much appreciated.
Regards,
James.