Lift 3 help for open source DBSchools Music Gradebook

124 views
Skip to first unread message

Dave Briccetti

unread,
Apr 11, 2015, 1:19:07 AM4/11/15
to lif...@googlegroups.com
Hi. I’m updating the open source project DBSchools Music Gradebook to the latest Scala, SBT, and Lift 3. I’ve made a lot of progress but these problems remain:

- Props doesn’t find the props files
- Field labels don’t show on editStudent.html
- Message: java.lang.RuntimeException: No session is bound to current thread, a session must be created via Session.create and bound to the thread via 'work' or 'bindToCurrentThread'
 Usually this error occurs when a statement is executed outside of a transaction/inTrasaction block



Ideally we could work these problems out together over a teleconference in California waking hours. Thanks in advance!

Diego Medina

unread,
Apr 13, 2015, 12:36:15 AM4/13/15
to Lift
Hi Dave,

Just some quick notes after looking at the build.scala

you have scalaz and specs2 built for scala 2.10, instead of 2.11, sooner or later those are going to give you issues.
The list version isn't the latest, 3.0-M5-1 is the latest lift version.


on your Boot.scala,

https://github.com/dcbriccetti/dbschools/blob/lift3/music-gradebook/src/main/scala/bootstrap/liftweb/Boot.scala#L84

that line isn't needed any more as it is set by default now (I think we changed it in 2.6, if not, for sure 3.0 uses that as the default)

>Props doesn’t find the props files

There is a dependency in your project that is messing with how Lift reads the classpath, I know at least apache shiro does that, and apparently some other dependency that you use (not sure which one), one temp. work around is to move the props file one level up, so instead of being inside the props folder, just move it into the resources folder. This isn't ideal if you have production/test/etc props file, but it may help you continue working on the project until you can find out which dep. is causing the problem.

May be related or not, but I saw several plugins dependencies added to plugins.sbt, do you need all of those?

>Field labels don’t show on editStudent.html

don't put the input tag inside the label tag, change it to something like:
       <label for="file">Upload a picture: </label>
       <input id="file">//note no closing input tag either

If that fixes it, it was related to the html5 parser, if it doesn't make any difference, then I'll have to try it out to figure out what the problem is, but it will be several days before I can run it


> Ideally we could work these problems out together over a teleconference in California waking hours. Thanks in advance!

Sorry but I avoid phone calls as much as possible.

Thanks

Diego


--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am

Dave Briccetti

unread,
Apr 13, 2015, 3:37:53 AM4/13/15
to lif...@googlegroups.com
Thanks, Diego!

Everything’s fixed except the field labels, which I’ve discovered are invisible due to CSS styles. I think I can fix that.

Diego Medina

unread,
Apr 14, 2015, 12:18:23 AM4/14/15
to Lift
great!

On Mon, Apr 13, 2015 at 3:37 AM, Dave Briccetti <dcbri...@gmail.com> wrote:
Thanks, Diego!

Everything’s fixed except the field labels, which I’ve discovered are invisible due to CSS styles. I think I can fix that.

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marc Grue

unread,
Apr 19, 2015, 3:59:11 PM4/19/15
to lif...@googlegroups.com
Hi Dave,

Thanks for your work with music-gradebook. After cloning the lift3 branch and running `sbt` and then `container:start` I get a JdbcSQLException for each database call that uses the date_trunc function:

279 [main] INFO com.dbschools.mgb.dbconn.Db$  - Db.initialize
2015-04-19 21:52:24.535:WARN:oejuc.AbstractLifeCycle:main: FAILED o.e.j.w.WebAppContext@3aa9e816{/,file:/Users/mg/code/dbschools/music-gradebook/target/webapp/,STARTING}{file:/Users/mg/code/dbschools/music-gradebook/target/webapp/}: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at com.dbschools.mgb.model.DefaultDataCreator$.com$dbschools$mgb$model$DefaultDataCreator$$createPredefinedComments(DefaultDataCreator.scala:30)
at com.dbschools.mgb.model.DefaultDataCreator$$anonfun$createIfEmpty$1.apply$mcV$sp(DefaultDataCreator.scala:18)
at com.dbschools.mgb.model.DefaultDataCreator$$anonfun$createIfEmpty$1.apply(DefaultDataCreator.scala:12)
at com.dbschools.mgb.model.DefaultDataCreator$$anonfun$createIfEmpty$1.apply(DefaultDataCreator.scala:12)
at org.squeryl.dsl.QueryDsl$class._using(QueryDsl.scala:45)
at org.squeryl.dsl.QueryDsl$class._executeTransactionWithin(QueryDsl.scala:115)
at org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:78)
at org.squeryl.PrimitiveTypeMode$.transaction(PrimitiveTypeMode.scala:40)
at com.dbschools.mgb.model.DefaultDataCreator$.createIfEmpty(DefaultDataCreator.scala:11)
at com.dbschools.mgb.dbconn.Db$.initialize(Db.scala:29)
at bootstrap.liftweb.Boot.boot(Boot.scala:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:357)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:355)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:2058)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:2058)
at net.liftweb.common.Full.map(Box.scala:806)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:2058)
at net.liftweb.http.provider.HTTPProvider$class.bootLift(HTTPProvider.scala:88)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:1063)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init(ServletFilterProvider.scala:40)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:1063)
at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:137)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:831)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:300)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1341)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1334)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:357)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.Server.doStart(Server.java:324)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.runner.Runner.run(Runner.java:509)
at org.eclipse.jetty.runner.Runner.main(Runner.java:557)
Caused by: 
java.lang.RuntimeException: Exception while executing statement : Function "DATE_TRUNC" not found; SQL statement:|Select|  assessment1.musician_id as g0,|  count(distinct date_trunc('day',assessment1.assessment_time)) as c0|From|  assessment assessment1|Where|  (assessment1.assessment_time > ?)|Group By|  assessment1.musician_id [90022-173]|errorCode: 90022, sqlState: 90022|Select|  assessment1.musician_id as g0,|  count(distinct date_trunc('day',assessment1.assessment_time)) as c0|From|  assessment assessment1|Where|  (assessment1.assessment_time > ?)|Group By|  assessment1.musician_id|jdbcParams:[2014-07-01 00:00:00.0]

Is it because h2 as the default db engine doesn't have date_trunc function? Should I get things running another way?

Thanks,
Marc
Message has been deleted

Dave Briccetti

unread,
Apr 19, 2015, 7:39:39 PM4/19/15
to lif...@googlegroups.com
While you’re looking at the lift3 branch, Marc, I’d love to have solutions for the various warning messages that appear on startup and on certain pages. Not found jar files and unknowns security-related messages from the browser.

Dave Briccetti

unread,
Apr 19, 2015, 7:40:12 PM4/19/15
to lif...@googlegroups.com
Hey, Marc, how would you feel about making a code change to eliminate the date_trunc function? I added it without realizing that h2 doesn’t support it. Or maybe you have another idea? We have another props file for PostgreSQL. 

Marc Grue

unread,
Apr 20, 2015, 1:45:56 AM4/20/15
to lif...@googlegroups.com
On Monday, April 20, 2015 at 1:40:12 AM UTC+2, Dave Briccetti wrote:
Hey, Marc, how would you feel about making a code change to eliminate the date_trunc function? I added it without realizing that h2 doesn’t support it. Or maybe you have another idea? We have another props file for PostgreSQL.

I would love to make a code change but I'm new to Lift so I have only managed to fumble around, for instance trying to switch to PostgreSQL without luck. 

Have you got the lift3 branch running on your machine?

Is there a reason to not use PostgreSQL only? And if you want H2, maybe the date_truncate to "day" could be done somehow programatically rather than with a database function? 

Thanks,
Marc



Dave Briccetti

unread,
Apr 22, 2015, 6:25:16 PM4/22/15
to lif...@googlegroups.com
Marc, with this change, it should work with h2 again: 


Anyone else care to run (container:start) and advise me on the several warning messages?

Marc Grue

unread,
Apr 26, 2015, 2:56:13 PM4/26/15
to lif...@googlegroups.com
Great, thanks! This works. Hope someone more experienced can help with the warnings...

Dave Briccetti

unread,
Apr 27, 2015, 8:17:23 PM4/27/15
to lif...@googlegroups.com
I just added a tempos editor feature. I’d love feedback from anybody on the code.

Reply all
Reply to author
Forward
0 new messages