playframework-2.6

Scala compile time error: No implicits found for parameter evidence$2: BodyWritable[Map[String, Object]]

五迷三道 提交于 2020-12-15 04:28:10
问题 I am working on scala play framework application. I am trying to call a web service API which takes request payload data as follows { "toID": [ "email1@email.com", "email2@email.com" ], "fromID": "info@test.com", "userID": "ervd12fdsfksdjnfn9832rbjfdsnf", "mailContent": "Dear Sir, ..." } And for this I am using following code ws.url(Utils.messengerServiceUrl + "service/email") .post( Map("userID" -> userID, "mailContent" -> userData.message, "fromID" -> "info@test.com", "toID" -> userData

Exception not getting handled in recover method

泄露秘密 提交于 2020-06-29 06:41:52
问题 This method throws exception @throws(classOf[QuestionNotFoundException]) def getQuestionFromQuestionID(questionKey: PracticeQuestionKeys) = { logger.trace(s"getting question with keys ${questionKey}") val practiceQuestionFuture: Future[Option[PracticeQuestion]] = findOne(questionKey) for (questionOption <- practiceQuestionFuture) yield { questionOption.fold(throw QuestionNotFoundException())(question => { logger.trace("got question " + question) question }) } } I use it like follows def

Play framework: Why does https url not work on using “sbt dist” command?

末鹿安然 提交于 2020-04-16 04:26:21
问题 I am trying to create executable file for deploying my web app using play framework sbt dist command. When I run my application using "sbt run" command then https work but when I use sbt dist and run my executable file to start my app then only http url works. Following is my configuration In build.sbt javaOptions ++= Seq( "-Dhttps.keyStore=conf/keystore.jks", "-Dhttps.keyStorePassword=*****", "-Dhttp.port=9000", "-Dhttps.port=9001", "-Dsentry.dsn=https://****" ) In application.conf play.http

EhCache instance with name 'play' already exists

时光总嘲笑我的痴心妄想 提交于 2020-01-23 12:34:10
问题 I faced the issue with the Play framework default cache ( EHCache ) when working with asynchronous couchdatabase java driver. Play crashes on the hot reload with the error: Error in custom provider, play.api.cache.EhCacheExistsException: An EhCache instance with name 'play' already exists. I found this could be not only with the couchdatabase driver but also in some other scenarios, like https://groups.google.com/forum/#!topic/pac4j-dev/2_EUOCrov7M. 回答1: I figure out a solution - force cache

Getting .UnsupportedOperationException: NoMaterializer does not provide an ExecutionContext Error

心已入冬 提交于 2020-01-22 02:26:30
问题 When I am trying to run the following test case class QuestionsControllerUnitSpec extends PlaySpec with BeforeAndAfterAll with BeforeAndAfterEach with OneAppPerSuiteWithComponents{ { ... "newQuestion" should { "should return error if the size of the body in the request is more than the maximum allowed size" in { val testEnv = new QuestionsControllerSpecTestEnv(components=components) val body = s""" |{ | "practice-question":{ | "description": "some description", | "hints": ["hint1","hint2"], |

Why two different versions of sbt in the project

拜拜、爱过 提交于 2020-01-06 02:48:06
问题 In my Play project I notice that build.properties has sbt version addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") and build.properties has sbt.version=0.13.15 . 1) Why are there two enteries? 2) What is the difference between them 3) Should their versions be different? 回答1: There is a difference between SBT proper and SBT plugin. Play Framework is an SBT plugin. The version of SBT is specified in project/build.properties : sbt.version=0.13.15 whilst the version of Play SBT plugin

Is there a specific release of Mockito I should use with Playspec

我只是一个虾纸丫 提交于 2019-12-25 01:35:52
问题 Is there a specific release of Mockito I should use with Playspec ? I am observing a strange pattern. When I start IntelliJ and run unit tests, I get error org.mockito.internal.invocation.ArgumentsProcessor.expandArgs(Lorg/mockito/internal/invocation/MockitoMethod;[Ljava/lang/Object;)[Ljava/lang/Object; . Then I close IntelliJ and restart it. Then the tests run!. This is repeatable behavior. I am wondering if this could be due to some incompatible library which somehow gets resolved when

Unable to use for comprehension to resolve Future

£可爱£侵袭症+ 提交于 2019-12-24 21:30:42
问题 I have this Action which should return a Future[Result] but I am unable to code it using for comprehension. This is the first time I am using for comprehension so I am also not sure if this is how I should use for . Also, would someone comment on whether the usage of for is correct? def verifyUser(token:String) = Action.async{ implicit request => { //the function takes a token val tokenFutureOption:Future[Option[UserToken]] = userTokenRepo.find(UserTokenKey(UUID.fromString(token))) //checkc