Request.params is gone in Play Framework 2.0

The Play 2.0 documentation doesn’t explain this very well. Body parsers are an acceptable solution, but I’ve found DynamicForm to be much more lightweight and user friendly. The documentation can be found here. In particular, the DynamicForm.bindFromRequest() is a good place to start if you are trying to replace the old Play 1.0 request.params.get().

Where to see the logged sql statements in play2?

1. application.conf make sure: db.default.logStatements=true This config is actually a setting of bonecp which is connection pool used in play2 2. custom logger Add a custom logger configuration to conf/logger.xml. The content may be: <configuration> <appender name=”STDOUT” class=”ch.qos.logback.core.ConsoleAppender”> <encoder> <pattern>%-5level – %msg%n</pattern> </encoder> </appender> <logger name=”com.jolbox.bonecp” level=”DEBUG”> <appender-ref ref=”STDOUT” /> </logger> <logger name=”play” level=”DEBUG”> <appender-ref … Read more

Ebean – Dynamic Query – Prepared Statement’s Mismatched Parameter Count Error

I’ve seen something similar (on DB2) using prepared statements. Querties only worked for the number of parameters the first statement executed had. Only the number of parameters it had the first time it was invoked or less would work. It probably set aside a buffer for the parameters – I believe it acted like the … Read more

Play Framework – add a field to JSON object

JsObject has a + method that allows you to add fields to an object, but unfortunately your jsonObject is statically typed as a JsValue, not a JsObject. You can get around this in a couple of ways. The first is to use as: scala> jsonObject.as[JsObject] + (“c” -> Json.toJson(3)) res0: play.api.libs.json.JsObject = {“a”:1,”b”:2,”c”:3} With as … Read more

Discovery of Akka actors in cluster

I’m working on a private project which is basically a very extended version of the chatroom example and I also had startup problems with akka and the whole “decentralized” thinking. So I can tell you how I “solved” my extended chatroom: I wanted a server which could easily be deployed multiple times without much additional … Read more

Error: scala: No ‘scala-library*.jar’ in Scala compiler library

Open File -> Project Structures -> Libraries, remove any scala sdk in it, e.g. scala-sdk-2.11.8 in the following image. Click on +, then Scala SDK. Select the right Scala SDK from the list, for me, it’s Ivy-Scala-2.11.8 shown in the picture. Select the current project(mine is spark-test), click OK. Then click OK to close it. … Read more

How to write JUnit test with Spring Autowire?

Make sure you have imported the correct package. If I remeber correctly there are two different packages for Autowiring. Should be :org.springframework.beans.factory.annotation.Autowired; Also this looks wierd to me : @ContextConfiguration(“classpath*:conf/components.xml”) Here is an example that works fine for me : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { “/applicationContext_mock.xml” }) public class OwnerIntegrationTest { @Autowired OwnerService ownerService; @Before public … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)