playframework-2.1

Invalid JSON in Playframework 2.1 Test POST Request

微笑、不失礼 提交于 2020-01-04 02:56:07
问题 I am trying to test a POST route (on Playframework 2.1/ Java) and keep getting Bad Request - Invalid JSON response. Please let me know what I am doing wrong. My Test code is below. running(fakeApplication(), new Runnable() { public void run() { Map map = new HashMap(); map.put("key1", "val1"); map.put("key2", 2); map.put("key3", true); JsonNode df= Json.toJson(map); Result result = route (fakeRequest(POST, "/item").withHeader("Content-Type", "application/json").withSession(AccountTest.USER

Auto-reloading with Play framework on a network filesystem

£可爱£侵袭症+ 提交于 2020-01-02 07:21:08
问题 I'm running a Play framework application on a VirtualBox VM with the project source code in a directory shared from the host system. The auto-reload functionality of the framework doesn't work. This is (probably) caused by JNotify being unable to detect the changes to the source files, as the filesystem is not local. Both NFS and vboxsf suffer from the same issue. Is there any way around this? Play framework has a built-in fallback mechanism for detecting changes on systems where JNotify is

Json Writes in Play 2.1.1

爱⌒轻易说出口 提交于 2020-01-02 05:33:18
问题 I started using the Playframework recently and am implementing a site using Play 2.1.1 and Slick 1.0.0. I'm now trying to wrap my head around Json Writes as I want to return Json in one of my controllers. I've been looking at several references on the subject (like this one and this one but can't figure out what I'm doing wrong. I have a model looking like this: case class AreaZipcode( id: Int, zipcode: String, area: String, city: String ) object AreaZipcodes extends Table[AreaZipcode]("wijk

Getting “how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name” compile error

北城以北 提交于 2020-01-01 09:43:19
问题 My Play 2.1.1 project uses SBT 0.12.3, and when compiling it on my dev machine, everything's fine, I get no errors, and the app runs without any issues. When I try to compile it on an EC2 instance used for testing, I get the superlong error message below. The only possibly relevant difference between the two environments is that I have java 6 (1.6.0_45) on my dev machine, and java 7 (1.7.0_19) on EC2, but I can't currently change neither. Have you ever seen something like this? What can this

Make Akka aware of Play's logback configuration

元气小坏坏 提交于 2020-01-01 09:28:11
问题 How do I make Akka aware of Play's logback config (application-logger.xml)? In my case it is completely ignored: The log is ONLY printed to stdout. I expect it to be logged to the File-Appender defined in application-logger.xml It does not make a difference if I rename application-logger.xml to logback.xml. Actor-class: class Dispatcher extends Actor with ActorLogging { // prints to stdout ONLY: log.error("[akka-logger] dispatch started...") } conf/application.conf: play { akka { #log-config

How use wro4j in play framework 2.1

我的未来我决定 提交于 2020-01-01 09:19:09
问题 there is a way to include wro4j http://code.google.com/p/wro4j/ in java play framework 2.1? i need to compile hogan.js templates and do much more without reinvent the route. maybe i should use interceptors (@Before, @After, @Finally) and creating a class that extend Application? regards 回答1: wro4j process resources either at build time or at runtime. I'm not aware of any Play2 integration/plugin/sample yet. You can use the wro4j SBT plugin available here: https://github.com/BowlingX/xsbt

Local dependencies resolved by SBT but not by Play! Framework

筅森魡賤 提交于 2020-01-01 03:09:10
问题 I'm trying to use banana-RDF, a locally published library (published using SBT's publish-local ) from a Play! Framework project, but when running compile from Play's console, the wanted library is not resolved, when using compile from SBT's console everything goes fine. I find this behavior pretty weird as Play uses SBT to resolve dependencies. By the way, I'm using the 0.12.3 version of SBT in my Play project. The error I'm getting when compiling with Play is pretty basic: [warn] module not

start shell script from “play dist” fails to locate logger.xml in JAR file

泪湿孤枕 提交于 2019-12-30 10:19:26
问题 I'm new to Play 2.1 and am trying to figure out the easiest way to deploy Play into our ops environment. The out-of-the-box Play 2.1 capability that holds the most promise is play dist Which builds a ZIP file that contains all the supporting JARs to run my app as well as some start shell script which launches the whole thing. Works like a champ. The problem is that my application requires more fine-grained logging than afforded by the out-of-the-box one-size-fits-all logs/application.log. On

Multiple Databases with Play Framework 2.1.x

女生的网名这么多〃 提交于 2019-12-29 21:10:57
问题 I have 2 databases that I need to connect to. I can easily connect to them in the application.conf file like so: db.default.driver=org.postgresql.Driver db.default.url="jdbc:postgresql://localhost/db1" db.default.user=postgres db.default.password="password" db.secondary.driver=org.postgresql.Driver db.secondary.url="jdbc:postgresql://localhost/db2" db.secondary.user=postgres db.secondary.password="password" ebean.default="models.db1.*" ebean.secondary="models.db2.*" I have my model classes in

Getting 502 bad request after deploying Play 2.1.0 app to Cloudbees

荒凉一梦 提交于 2019-12-25 11:15:14
问题 I tried to deploy a Play app to Cloudbees (only via push to git repo from which it is built by jenkins), it compiled and should work but I get a "502 Bad Gateway" error when loading the app. There is no error shown in the console only that it answers "502 Bad Gateway" when trying to access it. But that's what I see in the browser, too. Cloudbees say that there is no other manipulation necessary, just cloning/pulling the ClickStart-Project, making it you application and pushing it back. The