Searching turned up a few older threads similar to the problem I'm
seeing, but I couldn't find any solution.

Using just the skeleton project created by lift-archetype-basic, I'm
getting these exceptions out of jetty:

org.h2.jdbc.JdbcSQLException: Database may be already in use: Locked
by another process. Possible solutions: close all other connection(s);
use the server mode [90020-121]

ERROR - Failed to Boot
java.lang.NullPointerException: Looking for Connection Identifier
ConnectionIdentifier(lift) but failed to find either a JNDI data
source with the name lift or a lift connection manager with the
correct name

Once this happens, the app is non-functional.  This occurs whenever
jetty restarts due to updated code.  I can trigger the issue by:

1. Running mvn jetty:run in one console
2. Running mvn scala:cc in another console
3. Running touch src/main/scala/bootstrap/liftweb/Boot.scala in a 3rd
console

This causes a recompilation, which causes a jetty restart, which blows
up with the exceptions.

Has anybody else seen or fixed this issue?  Should it be useful, I've
stashed the project at 
http://nparry.com/posted_files/jetty_lift_issues/lifttest.tgz
including a jetty.log of the output with the full stack traces.


Wandering into wild-speculation territory (AKA speak and remove all
doubt) ...

Based on the jdbc exception, I poked around in the DB code - looking
at ProtoDBVendor I couldn't see how connections in 'pool' would ever
be released.  Thus I tried a quick hack in my project to force the
pool to be empty...

 DB.defineConnectionManager(DefaultConnectionIdentifier,
        new StandardDBVendor(
                             Props.get("db.driver") openOr
"org.h2.Driver",
                             Props.get("db.url") openOr
"jdbc:h2:lift_proto.db",
                             Props.get("db.user"),
                             Props.get("db.password")) {
            override def maxPoolSize = 0
        })

This obviously is not a good solution, but it does seem to clear up
the exceptions when jetty restarts - the theory being that during
shutdown the old connections are not closed, leading to errors during
restart since the new connection can't be created.  Forcing an empty
pool means there is no old connection around to trigger the problem.

I guess the question out of all that would be - do we need (or is
there already) a shutdown hook to correspond to the boot hook?  This
would allow for cleanup in this sort of situation (ie, close any
connections left in the pool).

--
Nathan

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to