Another backtrace on reload

23 views
Skip to first unread message

Nolan Darilek

unread,
Jun 24, 2009, 9:50:00 AM6/24/09
to lif...@googlegroups.com
I'm getting this one on server reloads if I have mvn scala:cc running in
one terminal and mvn jetty:run in another. Happens whenever I make a
code change that gets redeployed:

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
at net.liftweb.mapper.DB$$anonfun$3$$anonfun$apply$7.apply(DB.scala:95)
at net.liftweb.mapper.DB$$anonfun$3$$anonfun$apply$7.apply(DB.scala:95)
at net.liftweb.util.EmptyBox.openOr(Box.scala:372)
at net.liftweb.mapper.DB$$anonfun$3.apply(DB.scala:95)
at net.liftweb.mapper.DB$$anonfun$3.apply(DB.scala:95)
at net.liftweb.util.EmptyBox.openOr(Box.scala:372)
at net.liftweb.mapper.DB$.newConnection(DB.scala:89)
at net.liftweb.mapper.DB$.getConnection(DB.scala:136)
at net.liftweb.mapper.DB$.use(DB.scala:315)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36)
at bootstrap.liftweb.Boot.boot(Boot.scala:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1041)
at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1041)
at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1041)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:561)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:529)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
at
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.plugin.AbstractJettyRunMojo.restartWebApp(AbstractJettyRunMojo.java:446)
at
org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged(AbstractJettyRunMojo.java:407)
at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)
at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)
at org.mortbay.util.Scanner.scan(Scanner.java:280)
at org.mortbay.util.Scanner$1.run(Scanner.java:232)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
[INFO] Restart completed at Wed Jun 24 08:43:27 CDT 2009

David Pollak

unread,
Jun 24, 2009, 9:54:38 AM6/24/09
to lif...@googlegroups.com
Are you using JNDI or your own connection manager to connect to the RDBMS?
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Nolan Darilek

unread,
Jun 24, 2009, 10:16:11 AM6/24/09
to lif...@googlegroups.com
On 06/24/2009 08:54 AM, David Pollak wrote:
> Are you using JNDI or your own connection manager to connect to the RDBMS?
>
I'm new to this, but I'm guessing the latter. In any case, I haven't
touched whatever values the snapshot sets up in Boot.scala, nor have I
set any properties, so it's stock Derby.

David Pollak

unread,
Jun 24, 2009, 11:47:33 AM6/24/09
to lif...@googlegroups.com
I won't have a chance to look at it until next week, but maybe somebody else could step in here and help.

Naftoli Gugenhem

unread,
Jun 24, 2009, 1:49:52 PM6/24/09
to feeder.of...@gmail.com, lif...@googlegroups.com
I had the same problem a while ago. I'm not sure if I fixed it then, but I think it had to do with the db still being open possibly. When the code changes does the servlet get undeployed?
You might need to run derby in server mode.
Lately I've been launching jetty without maven, and to get it to reload eclipse calls an ant script that touches the context.xml. I'm using h2 in tcp mode.
Another option is JavaRebel which often obviates the need to redeploy.
Sorry I can't help you better--I'm interested in any more information there is about this too.

-------------------------------------

fricke

unread,
Jul 17, 2009, 4:41:51 PM7/17/09
to Lift

often it helps to do a dummy change and see if the compilation
correctly syncs with jetty's restart.
Once in a while jetty runs amok though (out of memory) - the kill and
restart

it's not really a solution but it helps to go on

in the end, I'm not a big fan of "mvn scala:cc" option since most of
the times jetty starts up when the compiler is only
half way through

markus

On Jun 24, 7:49 pm, Naftoli Gugenhem <naftoli...@gmail.com> wrote:
> I had the same problem a while ago. I'm not sure if I fixed it then, but I think it had to do with the db still being open possibly. When the code changes does the servlet get undeployed?
> You might need to run derby in server mode.
> Lately I've been launching jetty without maven, and to get it to reload eclipse calls an ant script that touches the context.xml. I'm using h2 in tcp mode.
> Another option is JavaRebel which often obviates the need to redeploy.
> Sorry I can't help you better--I'm interested in any more information there is about this too.
>
> -------------------------------------
>
> David Pollak<feeder.of.the.be...@gmail.com> wrote:
>
> I won't have a chance to look at it until next week, but maybe somebody else
> could step in here and help.
>
> On Wed, Jun 24, 2009 at 7:16 AM, Nolan Darilek <no...@thewordnerd.info>wrote:
>
>
>
> > On 06/24/2009 08:54 AM, David Pollak wrote:
> > > Are you using JNDI or your own connection manager to connect to the
> > RDBMS?
>
> > I'm new to this, but I'm guessing the latter. In any case, I haven't
> > touched whatever values the snapshot sets up in Boot.scala, nor have I
> > set any properties, so it's stock Derby.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Nolan Darilek

unread,
Aug 1, 2009, 10:39:03 AM8/1/09
to lif...@googlegroups.com
Wondering if anyone has gotten a chance to take a look at this? Life got
busy, and since my Lift projects aren't commercial just yet, they went
on the back burner. But I'm still seeing this.

Also, not sure how I missed this question, but I don't think SBT is
undeploying the app before redeploying. Should it be? Maybe this is an
SBT rather than a Lift issue?

Here is a partial transcript of an SBT session, not sure if these are
the same errors. It involves me making a code change, at which point
~prepare-webapp picks it up and redeploys. I then get an error, try
stopping and relaunching Jetty and get another. Also, after that point,
I can't access the web app unless I completely restart SBT. Sorry for
the ANSI escape sequences in this.

If this is an SBT issue then I'll gladly take it to that list. Thanks
for looking into this!

ERROR - Failed to Boot

java.lang.IllegalStateException: Cannot modify after boot.
at net.liftweb.http.RulesSeq$class.safe_$qmark(LiftRules.scala:1056)
at net.liftweb.http.RulesSeq$class.prepend(LiftRules.scala:1063)
at net.liftweb.http.RulesSeq$$anon$5.prepend(LiftRules.scala:1043)
at net.liftweb.http.LiftFilter.preBoot(LiftServlet.scala:564)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:555)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:530)


at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at

org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)

at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
sbt.LazyJettyRun$$anonfun$sbt$LazyJettyRun$$reload$6.apply(WebApp.scala:198)

at
sbt.LazyJettyRun$$anonfun$sbt$LazyJettyRun$$reload$6.apply(WebApp.scala:198)

at scala.List.foreach(List.scala:841)
at sbt.LazyJettyRun$.sbt$LazyJettyRun$$reload(WebApp.scala:198)
at sbt.LazyJettyRun$$anon$1.filesChanged(WebApp.scala:124)


at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)
at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)
at org.mortbay.util.Scanner.scan(Scanner.java:280)
at org.mortbay.util.Scanner$1.run(Scanner.java:232)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

[0m[ [0minfo [0m] [0mReload complete. [0m
[0m[ [0minfo [0m] [0mCompilation successful. [0m
[0m[ [0minfo [0m] [0m Post-analysis: 17 classes. [0m
[0m[ [0minfo [0m] [34m== compile == [0m
[0m[ [0minfo [0m] [34m [0m
[0m[ [0minfo [0m] [34m== prepare-webapp == [0m
[0m[ [0minfo [0m] [34m== prepare-webapp == [0m
[0m[ [32msuccess [0m] [0mSuccessful. [0m
[0m[ [0minfo [0m] [0m [0m
[0m[ [0minfo [0m] [0mTotal time: 10 s [0m
Waiting for source changes... (press any key to interrupt)
[0m[ [0minfo [0m] [0mReloading web application... [0m
[0m[ [0minfo [0m] [0mNO JSP Support for /, did not find
org.apache.jasper.servlet.JspServlet [0m


ERROR - Failed to Boot

java.lang.IllegalStateException: Cannot modify after boot.
at net.liftweb.http.RulesSeq$class.safe_$qmark(LiftRules.scala:1056)
at net.liftweb.http.RulesSeq$class.prepend(LiftRules.scala:1063)
at net.liftweb.http.RulesSeq$$anon$5.prepend(LiftRules.scala:1043)
at net.liftweb.http.LiftFilter.preBoot(LiftServlet.scala:564)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:555)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:530)


at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at

org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)

at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
sbt.LazyJettyRun$$anonfun$sbt$LazyJettyRun$$reload$6.apply(WebApp.scala:198)

at
sbt.LazyJettyRun$$anonfun$sbt$LazyJettyRun$$reload$6.apply(WebApp.scala:198)

at scala.List.foreach(List.scala:841)
at sbt.LazyJettyRun$.sbt$LazyJettyRun$$reload(WebApp.scala:198)
at sbt.LazyJettyRun$$anon$1.filesChanged(WebApp.scala:124)


at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)
at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)
at org.mortbay.util.Scanner.scan(Scanner.java:280)
at org.mortbay.util.Scanner$1.run(Scanner.java:232)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

[0m[ [0minfo [0m] [0mReload complete. [0m

> jetty-stop
[0m[ [0minfo [0m] [34m [0m
[0m[ [0minfo [0m] [34m== jetty-stop == [0m
[0m[ [0minfo [0m] [34m== jetty-stop == [0m
[0m[ [32msuccess [0m] [0mSuccessful. [0m
[0m[ [0minfo [0m] [0m [0m
[0m[ [0minfo [0m] [0mTotal time: 0 s [0m
> jetty-run
[0m[ [0minfo [0m] [34m [0m
[0m[ [0minfo [0m] [34m== compile == [0m
[0m[ [0minfo [0m] [0m Source analysis: 0 new/modified, 0 indirectly
invalidated, 0 removed. [0m
[0m[ [0minfo [0m] [0mCompiling main sources... [0m
[0m[ [0minfo [0m] [0mNothing to compile. [0m
[0m[ [0minfo [0m] [0m Post-analysis: 17 classes. [0m
[0m[ [0minfo [0m] [34m== compile == [0m
[0m[ [0minfo [0m] [34m [0m
[0m[ [0minfo [0m] [34m== prepare-webapp == [0m
[0m[ [0minfo [0m] [34m== prepare-webapp == [0m
[0m[ [0minfo [0m] [34m [0m
[0m[ [0minfo [0m] [34m== jetty-run == [0m
2009-07-30 08:49:12.337::INFO: Logging to STDERR via
org.mortbay.log.StdErrLog
[0m[ [0minfo [0m] [0mjetty-6.1.14 [0m
[0m[ [0minfo [0m] [0mNO JSP Support for /, did not find
org.apache.jasper.servlet.JspServlet [0m
java.sql.SQLException: Failed to start database 'lift_example', 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.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(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 bootstrap.liftweb.DBVendor$.createOne(Boot.scala:79)
at bootstrap.liftweb.DBVendor$.newConnection(Boot.scala:91)
at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:89)
at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:89)
at net.liftweb.util.Full.flatMap(Box.scala:332)


at net.liftweb.mapper.DB$.newConnection(DB.scala:89)
at net.liftweb.mapper.DB$.getConnection(DB.scala:136)
at net.liftweb.mapper.DB$.use(DB.scala:315)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36)
at bootstrap.liftweb.Boot.boot(Boot.scala:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)
at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)

at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)

at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)

at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)

at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:556)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:530)


at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at

org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)

at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at sbt.LazyJettyRun$.apply(WebApp.scala:159)
at sbt.JettyRun$.runJetty$1(WebApp.scala:46)
at sbt.JettyRun$.liftedTree1$1(WebApp.scala:55)
at sbt.JettyRun$.run(WebApp.scala:53)
at sbt.JettyRun$.apply(WebApp.scala:34)
at
sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:327)
at
sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:327)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.runTask(RunTask.scala:78)
at sbt.impl.RunTask.run(RunTask.scala:31)
at sbt.impl.RunTask$.apply(RunTask.scala:16)
at sbt.impl.RunTask$.apply(RunTask.scala:15)
at sbt.Project$class.run(Project.scala:98)
at sbt.Project$class.act(Project.scala:129)
at sbt.BasicScalaProject.act(DefaultProject.scala:19)
at sbt.Main$$anonfun$11.apply(Main.scala:375)
at sbt.Main$$anonfun$11.apply(Main.scala:375)
at sbt.Main$.withAction(Main.scala:407)
at sbt.Main$.sbt$Main$$handleAction(Main.scala:375)
at sbt.Main$.handleInteractiveCommand(Main.scala:364)
at sbt.Main$.loop$1(Main.scala:266)
at sbt.Main$.interactive(Main.scala:274)
at sbt.Main$.startProject(Main.scala:102)
at sbt.Main$.run(Main.scala:76)
at sbt.Main.run(Main.scala)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.boot.Boot$.run(Boot.scala:93)
at sbt.boot.Boot$.load(Boot.scala:80)
at sbt.boot.Boot$.boot(Boot.scala:53)
at sbt.boot.Boot$.main(Boot.scala:31)
at sbt.boot.Boot.main(Boot.scala)
Caused by: java.sql.SQLException: Failed to start database
'lift_example', 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)
... 82 more

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)

at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)

at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)

at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:556)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:530)


at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at

org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)

at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at sbt.LazyJettyRun$.apply(WebApp.scala:159)
at sbt.JettyRun$.runJetty$1(WebApp.scala:46)
at sbt.JettyRun$.liftedTree1$1(WebApp.scala:55)
at sbt.JettyRun$.run(WebApp.scala:53)
at sbt.JettyRun$.apply(WebApp.scala:34)
at
sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:327)
at
sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:327)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.runTask(RunTask.scala:78)
at sbt.impl.RunTask.run(RunTask.scala:31)
at sbt.impl.RunTask$.apply(RunTask.scala:16)
at sbt.impl.RunTask$.apply(RunTask.scala:15)
at sbt.Project$class.run(Project.scala:98)
at sbt.Project$class.act(Project.scala:129)
at sbt.BasicScalaProject.act(DefaultProject.scala:19)
at sbt.Main$$anonfun$11.apply(Main.scala:375)
at sbt.Main$$anonfun$11.apply(Main.scala:375)
at sbt.Main$.withAction(Main.scala:407)
at sbt.Main$.sbt$Main$$handleAction(Main.scala:375)
at sbt.Main$.handleInteractiveCommand(Main.scala:364)
at sbt.Main$.loop$1(Main.scala:266)
at sbt.Main$.interactive(Main.scala:274)
at sbt.Main$.startProject(Main.scala:102)
at sbt.Main$.run(Main.scala:76)
at sbt.Main.run(Main.scala)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.boot.Boot$.run(Boot.scala:93)
at sbt.boot.Boot$.load(Boot.scala:80)
at sbt.boot.Boot$.boot(Boot.scala:53)
at sbt.boot.Boot$.main(Boot.scala:31)
at sbt.boot.Boot.main(Boot.scala)
[0m[ [0minfo [0m] [0mStarted SelectChann...@0.0.0.0:8080 [0m
[0m[ [0minfo [0m] [34m== jetty-run == [0m
[0m[ [32msuccess [0m] [0mSuccessful. [0m
[0m[ [0minfo [0m] [0m [0m
[0m[ [0minfo [0m] [0mTotal time: 8 s [0m


On 06/24/2009 12:49 PM, Naftoli Gugenhem wrote:
> I had the same problem a while ago. I'm not sure if I fixed it then, but I think it had to do with the db still being open possibly. When the code changes does the servlet get undeployed?
> You might need to run derby in server mode.
> Lately I've been launching jetty without maven, and to get it to reload eclipse calls an ant script that touches the context.xml. I'm using h2 in tcp mode.
> Another option is JavaRebel which often obviates the need to redeploy.
> Sorry I can't help you better--I'm interested in any more information there is about this too.
>
> -------------------------------------
> David Pollak<feeder.of...@gmail.com> wrote:
>
> I won't have a chance to look at it until next week, but maybe somebody else
> could step in here and help.
>
> On Wed, Jun 24, 2009 at 7:16 AM, Nolan Darilek<no...@thewordnerd.info>wrote:
>
>
>> On 06/24/2009 08:54 AM, David Pollak wrote:
>>
>>> Are you using JNDI or your own connection manager to connect to the
>>>
>> RDBMS?
>>
>>>
>> I'm new to this, but I'm guessing the latter. In any case, I haven't
>> touched whatever values the snapshot sets up in Boot.scala, nor have I
>> set any properties, so it's stock Derby.
>>
>>
>>>
>>
>
>


--
Nolan Darilek
http://thewordnerd.info

Tim Nelson

unread,
Aug 1, 2009, 11:25:32 AM8/1/09
to Lift
I was having the same problems using jetty's hot deploy with ~ prepare-
webapp in sbt so I switched to using JavaRebel. It works much better
and I haven't had any problems with reloading since. I don't think
there's any info on the sbt site about jrebel, but it's real easy to
get set up. Just install it and get a license (free for scala use)
from them at:
http://www.zeroturnaround.com/scala-license/

Then change your sbt script to:
java -Xmx256M -noverify -javaagent:/path/to/javarebel-2.0.2/
javarebel.jar -jar `dirname $0`/sbt-launcher-0.5.1.jar "$@"

I did run into a problem using an embedded H2 database, which may or
may not occur with Derby, when using jetty-run/jetty-stop from the sbt
prompt. What happens is jetty-stop does not shutdown the jvm, so H2
doesn't shut down. To get around this I use "sbt jetty" directly in
the terminal, that way when you stop it, the jvm shuts down and the db
with it. I then have a second terminal that I open an sbt prompt in
and use ~ prepare-webapp.

For me, this setup has worked much better.

Tim
> ...
>
> read more »

Tim Nelson

unread,
Aug 1, 2009, 12:07:33 PM8/1/09
to Lift
I just read your original post and that error is exactly what I was
referring to in my last post. The problem is, by default, the database
shuts down when the jvm shuts down. So, if you want to dynamically
restart jetty, you need a way to shutdown the db if the jvm is not
shutown. You can do as I described in my last post, using sbt, but
there are other options. I'm not sure if that will work with mvn.

H2 comes with a DbStarter [1] ServletContextListener that will start
up and shutdown the db. It can also start up a tcp server, if you need
that. However, it requires you to specify the db url, user, and pass
as context-params. Which is a show stopper for me.

There is only one line in DbStarter that one would really need and
that is a sql statement that is sent to the db. This code is in the
contextDestroyed method. So, if there is a way in Lift to call some
code when the servlet context is destroyed, then one could put that
sql statement there and manually shutdown the db.

I realize you use Derby, but I'm guessing that it works similarly.

So, Lifters, is there a way to call some code when the context is
destroyed? Or, is there another way to accomplish this?

[1] http://code.google.com/p/h2database/source/browse/trunk/h2/src/main/org/h2/server/web/DbStarter.java
> ...
>
> read more »

David Pollak

unread,
Aug 2, 2009, 10:02:20 AM8/2/09
to lif...@googlegroups.com
Tim,

Please take a look at LiftRules.unloadHooks.  These functions will be executed when the servlet is unloading.

With that being said, I'd suggest not using Jetty's auto-restart feature.  If you do, please use an external RDBMS (I find Postgres to be the best) rather than Derby.

Thanks,

David

Tim Nelson

unread,
Aug 2, 2009, 5:32:05 PM8/2/09
to lif...@googlegroups.com
David,

I actually use java rebel and don't auto reload jetty, but you still need to re-start it sometimes. Anyway, I just start jetty in batch mode (using sbt), so it's not really an issue. The situation got me thinking about a shutdown hook and I was just curious if there was something like that. Thanks for pointing that out.

Tim
Reply all
Reply to author
Forward
0 new messages