scala - Play-Framework: 2.3.x: play - Cannot invoke the action, eventually got an error: java.lang.IllegalArgumentException: -


i using play-framework 2.3.x reactivemongo-extension json type. following code fetch data db below:

def getstoredaccesstoken(authinfo: authinfo[user]) = { println(">>>>>>>>>>>>>>>>>>>>>>: before"); //$doc("clientid" $eq authinfo.user.email, "userid" $eq authinfo.user._id.get) var future = accesstokenservice.findrandom(json.obj("clientid" -> authinfo.user.email, "userid" -> authinfo.user._id.get)); println(">>>>>>>>>>>>>>>>>>>>>>: after: "+future); future.map { option => {   println("*************************** ")   println("***************************: "+option.isempty)   if (!option.isempty){    var accesstoken = option.get;println(">>>>>>>>>>>>>>>>>>>>>>: before value");    var value = crypto.validatetoken(accesstoken.createdat.value)    println(">>>>>>>>>>>>>>>>>>>>>>: "+value);    some(scalaoauth2.provider.accesstoken(accesstoken.accesstoken, accesstoken.refreshtoken, authinfo.scope,         some(value), new date(accesstoken.createdat.value)))   }else{     option.empty   } }} 

}

when using bsondao , bsondocument fetching data, code run, after converting jsondao getting following error:

note: time code run thrown exception after converting json

play - cannot invoke action, got error: java.lang.illegalargumentexception: bound must positive application -  

following logs of application full exception strack trace below:

>>>>>>>>>>>>>>>>>>>>>>: before >>>>>>>>>>>>>>>>>>>>>>: after:   scala.concurrent.impl.promise$defaultpromise@7f4703e3 play - cannot invoke action, got error: java.lang.illegalargumentexception: bound must positive application -  ! @6m1520jff - internal server error, (post) [/oauth2/token] -> play.api.application$$anon$1: execution exception[[illegalargumentexception: bound must positive]] @ play.api.application$class.handleerror(application.scala:296) ~[play_2.11-2.3.8.jar:2.3.8] @ play.api.defaultapplication.handleerror(application.scala:402) [play_2.11-2.3.8.jar:2.3.8] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$3$$anonfun$applyorelse$4.apply(playdefaultupstreamhandler.scala:320) [play_2.11-2.3.8.jar:2.3.8] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$3$$anonfun$applyorelse$4.apply(playdefaultupstreamhandler.scala:320) [play_2.11-2.3.8.jar:2.3.8] @ scala.option.map(option.scala:146) [scala-library-2.11.6.jar:na] caused by: java.lang.illegalargumentexception: bound must positive @ java.util.random.nextint(random.java:388) ~[na:1.8.0_40] @ scala.util.random.nextint(random.scala:66) ~[scala-library-2.11.6.jar:na] 

the problem solve, not sure, why produce, think there problem reactivemongo-extension jsondao library. because when use findone instead of findrandom code run successfully, findrandom run on bson dao. still not found exact problem that, following resolved code.

def getstoredaccesstoken(authinfo: authinfo[user]) = { println(authinfo.user.email+" ---- "+authinfo.user._id.get) var future = accesstokenservice.findone($doc("clientid" $eq authinfo.user.email, "userid" $eq authinfo.user._id.get)); //user findone instead of findrandom in jsondao future.map { option => {   if (!option.isempty){    var accesstoken = option.get;    var value = crypto.validatetoken(accesstoken.createdat.value)    some(scalaoauth2.provider.accesstoken(accesstoken.accesstoken, accesstoken.refreshtoken, authinfo.scope,         some(value), new date(accesstoken.createdat.value)))   }else{     option.empty   } }} 

}


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -