Migration Lift 2.2 to 2.6 Recommendations?

86 views
Skip to first unread message

Christoph Knabe

unread,
Mar 16, 2015, 7:46:15 AM3/16/15
to lif...@googlegroups.com
Hi folks,

I am running a Lift 2.2 / Scala 2.8 application without big modifications since 2011. Now I would like to migrate it to current Lift 2.6 and Scala 2.11.

Have you recommendations how to proceed?

My Lift templates are all still in Lift 1 style with Lift specific XML elements.

Thank you very much,

Christoph Knabe

Diego Medina

unread,
Mar 16, 2015, 10:06:43 AM3/16/15
to Lift
Hi,

You have a few options, you could go all the way and migrate your templates to use data-lift for snippet invocation as well as html5 templates and css selectors, but depending on the size of your app, this may be a huge amount of work.

Another option, which is less work, is to still use the old xml notations on your templates, but make sure to add this line in Boot:

LiftRules.htmlProperties.default.set((r: Req) => new OldHtmlProperties(r.userAgent))

This let's you still use xhtml templates. And you can slowly mograte your snippets to use css selectors, etc.
Also note that the modules are not part of the main lift project, but moved to a liftmodules domain, so you will have to modify some import and dependencies.

Those are the biggest things I can think of right now, but as you upgrade and run into issues, just post back on this thread and we'll help you.

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

Christoph Knabe

unread,
Mar 16, 2015, 10:19:58 AM3/16/15
to lif...@googlegroups.com
Hi Diego,

thanks for your quick reaction.

I will try it during the next days and I will use the compatibility way, because I mainly want to use a newer Scala version in my app.

Best wishes,

Christoph

Christoph Knabe

unread,
Aug 4, 2015, 7:17:36 AM8/4/15
to Lift
Problem: CometActor.partialUpdate without effect.

Hi Diego,

thank you very much for your migration advice of 16th of march. Unfortunately I have only 2 times a year enough capacity to handle non-trivial things.

According to your recommendations I have upgraded my application to Lift 2.6 and Scala 2.10, as liftmodules.widgets_2.6 exists only up to Scala 2.10.

After some tweakings including activation of OldHtmlProperties by LiftRules the application runs overall well.

But in one area I did not succeed. The application sends many eMails. I have a Comet form, which should display a feedback for each eMail address, either send success or send failure.

In my CometActor in the lowPriority method I have the branch

    case MailAddressFailure(email) =>
      _log.debug("Received failure " + email)
      partialUpdate(PrependHtml("addressesFail", Text(email) ++ (<br/>)))
      updateSendStatus

When an address fails, the CometActor receives the case message MailAddressFailure(email), logs "Received failure" as programmed above, and then calls the inherited method "CometActor.partialUpdate" with a "PrependHtml" command. But unfortunately this JsCmd does not have an effect on the client side. Also this.error(message) does not have a visible effect.

I am struggling with how to find out why there is no effect.
In Firefox developer tools console I find
" [HTTP/1.1 200 OK 265ms]
Kein Element gefunden F9310214980291KUYSK:1:1
GET https://localhost:9243/lehrkraftnews/comet_request/81429541732/z9x4zok3wpep/F9310214980291KUYSK [HTTP/1.1 200 OK 74382ms]
POST https://localhost:9243/lehrkraftnews/ajax_request/F9310214980291KUYSK/ [HTTP/1.1 200 OK 135ms]
Kein Element gefunden F9310214980291KUYSK:1:1
GET https://localhost:9243/lehrkraftnews/comet_request/23091197280/z9x4zok3wpep/F9310214980291KUYSK [HTTP/1.1 200 OK 73683ms]
POST https://localhost:9243/lehrkraftnews/ajax_request/F9310214980291KUYSK/ [HTTP/1.1 200 OK 141ms]
Kein Element gefunden F9310214980291KUYSK:1:1
GET https://localhost:9243/lehrkraftnews/comet_request/44415591304/z9x4zok3wpep/F9310214980291KUYSK"

When I click on the link after "Kein Element gefunden" (meaning "No element found") I see only an empty window.

I have manually included jquery-1.8.0.min.js and jquery-ui-1.8.23.custom.min.js into the page which shows the Comet form.

Any help appreciated.

Thanks in advance,

Christoph



Richard Dallaway

unread,
Aug 5, 2015, 4:17:10 AM8/5/15
to lif...@googlegroups.com
On Tue, 4 Aug 2015 at 12:17 Christoph Knabe <kn...@beuth-hochschule.de> wrote:
According to your recommendations I have upgraded my application to Lift 2.6 and Scala 2.10, as liftmodules.widgets_2.6 exists only up to Scala 2.10.

It's not obvious, but that module is available as version "1.4-SNAPSHOT" for Scala 2.11 and Lift 2.6.

Richard

Christoph Knabe

unread,
Aug 15, 2015, 3:56:53 AM8/15/15
to Lift
Finally I have solved the problem: CometActor.partialUpdate without effect.

It showed up as effect of the migration from Lift 2.2 to 2.6.

As I could not locate the reason, why partialUpdate did not have an effect, I supposed it to be a library version issue.

So in the end I constructed the build system of my project from scratch with the side-effect of migration from Maven to sbt.
I firstly tested the Comet part of https://github.com/fmpwizard/lift_25_samples with Scala 2.10, then starting from the template https://github.com/lift/lift_25_sbt/tree/master/scala_210/lift_basic I added my project sources and libraries step by step. In the end it works and I am happy.

Seems I should more regularly migrate to newer versions when they appear.

Thanks for your support,

Christoph

Antonio Salazar Cardozo

unread,
Aug 17, 2015, 1:09:12 PM8/17/15
to Lift
Do you have any indications as to what the differences ultimately were? I'm
concerned that something so basic seemed to break between minor versions, and
it'd be super-useful to know how it broke so we can try to avoid it in the future.
Thanks,
Antonio

Christoph Knabe

unread,
Aug 20, 2015, 9:16:32 AM8/20/15
to Lift
Hi Antonio,

thanks for asking about details of my solution.

For a long time I did not have any idea, why CometActor.partialUpdate("messages") did not show errors registered by CometActor.error(...). Searching internet and especially this group did not give obvious hints. But one contribution mentioned having several versions of a library in the classpath as a reason for partialUpdate not working.

That is why I tried to make the build script from scratch. After having success with this I changed my test scenario from dummy mail sending to real mail sending and again: Nothing happened and no error message was shown. But at this moment I was sure, that partialUpdate is working for XML elements inside the Comet form. It seemed not to update the "messages" element for displaying Comet error messages. Further reading gave me a hint how to test partialUpdate. Someone recommended to call partialUpdate(Alert("my error message")). This worked well, so I was already sure, that partialUpdate does its job. So the question was left, why it did not trigger display of registered error messages.

During a series of retrying I one time saw a short appearance of a red area and supposed it to be the displayed error message. Now the question was, why did it disappear so quickly. This led me to a feature of the application. After sending a series of eMails and showing the adresses in the Comet form, it re-initializes the Comet form. This happpened to clear all error notices, too.

After having removed this re-initialization of the Comet form after the end-of-processing my eMail send application works well and shows eMailing errors: General errors in the "messages" element and errors for an individual eMail address inside the Comet form.

In the end I would say it was an application error, which too early cleared the form and with it the "messages" element. So my error messages were cleared before I could see them.
My recommendation for others doubting if their partialUpdate works, is to test it with an Alert("message") JsCmd.

Best whishes,

Christoph

Antonio Salazar Cardozo

unread,
Aug 20, 2015, 12:25:31 PM8/20/15
to Lift
Awesome, thanks so much for breaking that down for us! Definitely the kind
of pernicious bug that's nabbed more than one of us in the past :)
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages