title: Error 500 for basic REST service in Lift Scala MongoDB while createRecord
body: <p>The REST service object code is: </p>
  
  <pre><code>object Account extends RestHelper {
    def createUser = {
      for {
        username &lt;- S.param("username") ?~ "username parameter missing" ~&gt; 400
        number &lt;- S.param("number") ?~ "number parameter missing"
      } yield {
        val u = GeoFence.createRecord.name(username)
        u.save
        u.asJSON
      }
    }
  
    serve {
      case Req("api" :: "hello" :: Nil, "json", GetRequest) =&gt; JString("hi")
      case Req("api" :: "accounts" :: "new" :: Nil, "json", GetRequest) =&gt; createUser()
    }
  }
  </code></pre>
  
  <p>This is the exception I see on browser whenever I'm trying to run the REST service.</p>
  
  <p>The exception is pointing to line 27 which is:</p>
  
  <blockquote>
    <p>val u = GeoFence.createRecord.name(username)</p>
    
    <p>u.save</p>
  </blockquote>
  
  <p>HTTP ERROR 500</p>
  
  <p>Problem accessing /api/accounts/new.json. Reason:</p>
  
  <pre><code>(class: net/liftweb/record/Record$class, method: toForm signature: (Lnet/liftweb/record/Record;Lscala/Function1;)Lscala/xml/NodeSeq;) Incompatible object argument for function call
  </code></pre>
  
  <p>Caused by:</p>
  
  <p>java.lang.VerifyError: (class: net/liftweb/record/Record$class, method: toForm signature: (Lnet/liftweb/record/Record;Lscala/Function1;)Lscala/xml/NodeSeq;) Incompatible object argument for function call
      at smartfamily.model.GeoFence.(GeoFence.scala:21)
      at smartfamily.model.GeoFence$.(GeoFence.scala:19)
      at smartfamily.model.GeoFence$.(GeoFence.scala)
      at smartfamily.api.Account$$anonfun$createUser$1$$anonfun$apply$1.apply(Account.scala:27)
      at smartfamily.api.Account$$anonfun$createUser$1$$anonfun$apply$1.apply(Account.scala:25)
      at net.liftweb.common.Full.map(Box.scala:478)
      at smartfamily.api.Account$$anonfun$createUser$1.apply(Account.scala:25)
      at smartfamily.api.Account$$anonfun$createUser$1.apply(Account.scala:24)
      at net.liftweb.common.Full.flatMap(Box.scala:480)
      at smartfamily.api.Account$.createUser(Account.scala:24)
      at smartfamily.api.Account$$anonfun$1.apply(Account.scala:35)
      at smartfamily.api.Account$$anonfun$1.apply(Account.scala:33)
      at net.liftweb.http.rest.RestHelper$class.apply(RestHelper.scala:472)
      at smartfamily.api.Account$.apply(Account.scala:21)
      at smartfamily.api.Account$.apply(Account.scala:21)
      at net.liftweb.util.NamedPF$$anonfun$applyBox$1.apply(NamedPartialFunction.scala:97)
      at net.liftweb.util.NamedPF$$anonfun$applyBox$1.apply(NamedPartialFunction.scala:97)
      at net.liftweb.common.Full.map(Box.scala:478)
      at net.liftweb.util.NamedPF$.applyBox(NamedPartialFunction.scala:97)
      at net.liftweb.http.LiftServlet.doService(LiftServlet.scala:220)
      at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply$mcZ$sp(LiftServlet.scala:129)
      at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:129)
      at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:129)
      at net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:344)
      at net.liftweb.util.Helpers$.calcTime(Helpers.scala:34)
      at net.liftweb.util.TimeHelpers$class.logTime(TimeHelpers.scala:353)
      at net.liftweb.util.Helpers$.logTime(Helpers.scala:34)
      at net.liftweb.http.LiftServlet.doIt$1(LiftServlet.scala:128)
      at net.liftweb.http.LiftServlet.service(LiftServlet.scala:137)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(HTTPProvider.scala:69)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply(HTTPProvider.scala:68)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply(HTTPProvider.scala:68)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.URLRewriter$.doWith(Req.scala:1063)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply$mcV$sp(HTTPProvider.scala:67)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply(HTTPProvider.scala:67)
      at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply(HTTPProvider.scala:67)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.provider.HTTPProvider$class.service(HTTPProvider.scala:63)
      at net.liftweb.http.LiftFilter.service(LiftServlet.scala:689)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ServletFilterProvider.scala:67)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1$$anonfun$apply$mcV$sp$1.apply(ServletFilterProvider.scala:62)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1$$anonfun$apply$mcV$sp$1.apply(ServletFilterProvider.scala:62)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13$$anonfun$apply$14$$anonfun$apply$15.apply(Vars.scala:513)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13$$anonfun$apply$14.apply(Vars.scala:512)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13.apply(Vars.scala:511)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12.apply(Vars.scala:510)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$class.apply(Vars.scala:509)
      at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:428)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply$mcV$sp(ServletFilterProvider.scala:61)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:61)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:61)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13$$anonfun$apply$14$$anonfun$apply$15.apply(Vars.scala:513)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13$$anonfun$apply$14.apply(Vars.scala:512)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12$$anonfun$apply$13.apply(Vars.scala:511)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$12.apply(Vars.scala:510)
      at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
      at net.liftweb.http.CoreRequestVarHandler$class.apply(Vars.scala:509)
      at net.liftweb.http.TransientRequestVarHandler$.apply(Vars.scala:432)
      at net.liftweb.http.provider.servlet.ServletFilterProvider$class.doFilter(ServletFilterProvider.scala:60)
      at net.liftweb.http.LiftFilter.doFilter(LiftServlet.scala:689)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Well it was resolved by the excellent lift community at the given link. </p>
  
  <p><a href="http://groups.google.com/group/liftweb/browse_thread/thread/e70cc3763734fdd9" rel="nofollow">http://groups.google.com/group/liftweb/browse_thread/thread/e70cc3763734fdd9</a></p>