Questions tagged [playframework-2.5]

Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

1
vote
0answers
15 views

How to use 2 datasources with Ebean on a Play Framework 2.5 project?

I would like to split my default datasource to 2 different datasources (2 databases). I set my application.conf file: db { common.driver = org.mariadb.jdbc.Driver common.username = "root" ...
2
votes
2answers
44 views

Play Framework: No implicit format for Map

Using Play 2.5 I cannot seem to serialize a Map[SomeCaseClass, String] case class SomeCaseClass(value: String) implicit val formatSomeCaseClass = Json.format[SomeCaseClass] Json.toJson(Map[...
0
votes
0answers
13 views

How to use / inject WSClient in akka actor in Playframework-2.5.x?

I have to hit an API on dialy basis. For that I have 1. created an actor, scheduler 2. bind actor & scheduler in Module 3. Enabled that Module in application.conf file The scheduling is ...
1
vote
1answer
26 views

Is there plugins in Play 2.5.x for capturing Request and Response for custom logging purpose?

I'm looking for any possible solutions/plugins to capture request and response that come through Play 2.5.x for making a custom logging. I've found https://www.playframework.com/documentation/2.5.x/...
1
vote
0answers
58 views

Playframework [Java]: what replaces @play.api.cache.Cache.getOrElse when migrating from Play 2.5 to 2.6

I hava a Play 2.5 Java project which has a bunch of templates (i.e. *.scala.html files) associated with it. I am attempting to upgrade the project from 2.5 to 2.6 but the project no longer compiles, ...
1
vote
0answers
44 views

Issue Running Distributed Play Framework Project

I have dist my play framework project and deploy on my production server. However, when try to run the project I'm getting an ambiguous error; I have searched around to see a way out, but it obvious ...
1
vote
1answer
121 views

Play Framework 2.5.12 - set multiple filter in application.conf

I'm using Play Framework 2.5.12 (Java version). When I declare a filter (Filters1) and set below config in application.conf: play.http.filters = my.filter.path.Filters1 It works fine. But I have ...
0
votes
1answer
27 views

java.lang.NoClassDefFoundError : com/google/gson/JsonElement on playframework does not work when starting the server

in sbt.build add to libraryDependencies += "com.google.code.gson" % "gson" % "2.2.4" but when doing deploy in intellij with the command: 'activator clean stage' and raise the server, the following ...
0
votes
0answers
63 views

Play 2.5 using dependency injection in template

I upgraded to Play 2.5 and moving everything to dependency injection. The class UiCommonService is now service, that is injectable, it used to be static. This is how the the controller looks like. ...
0
votes
0answers
46 views

Dynamically adding route to the route file of play framework

Play framework service framework provides a "conf/route" file where routes are added statically like below. GET /users/:username controllers.Users.showUser(username) GET /users/browse ...
0
votes
1answer
34 views

Playframework [Scala]: Problems with i18n after migrating from 2.5 to 2.6

I am working on migrating my project from play 2.5 to 2.6. Everything seems ok, however, there is a problem with i18n in within my views, rendered by scala controllers(and there is no such problem ...
2
votes
1answer
594 views

Troubleshooting “Out of Memory Error: Metaspace” in Play for Scala

While working in development mode in Play for Scala (2.5.x), after around three hours of changing code and hot-deploying, Play hungs with the error java.lang.OutOfMemoryError: Metaspace. After some ...
1
vote
0answers
56 views

Error in Extending the GuiceApplicationLoader : No implementation for play.Application was bound. while locating play.Application

I am trying to Extend the GuiceApplicationLoader in play java project as shown here in official play documentation. (https://www.playframework.com/documentation/2.6.x/JavaDependencyInjection) I am ...
0
votes
1answer
39 views

play framework 2.5.9 classNotFound exception for logback Filter on startup

I'm writing my own Filter class for logback as shown here. I am then calling it in logback.xml like this: <filter class="utils.LogbackFilter" /> I converted the sample Java code to Scala and ...
0
votes
1answer
26 views

Implementing Nashorn in Play for Scala controller

The code below executes a Nashorn/Javascript script in a Play (2.5) for Scala controller. I inject a class to get the engine that runs the script. I researched online and there are mixed opinions ...
1
vote
1answer
73 views

Cannot send to the browser ByteArrayOutputStream in Play for Scala

I have the following code in Play for Scala that attempts to send an Excel file to the browser: val out = new ByteArrayOutputStream val exporter = new org.pivot4j.ui.poi....
0
votes
1answer
52 views

Play framework 2.5 - communication with client

I have a Java Play Framework 2.5 project where periodically I have to update the registries of our customer. I can't do a simple SQL insert/update because I to do some logic and operation on every ...
1
vote
0answers
27 views

Play! framework: get controller's component/field/object between requests

I'm new to Play! and during working within a project I came with the follow situation: I have a controller HomeController which has two main actions: public CompletationStage<Result> search(...
0
votes
1answer
59 views

Specify MIME type when downloading binary file with OK() in Play for Scala

I download a binary file using Play for Scala like so: class Test extends Controller { def test = Action { request => val byteArray = Files.readAllBytes(Paths.get("path/to/file.jpeg"...
0
votes
1answer
37 views

Play production environment generation throws warnings

Every time I run dist to generate the production environment I get the following warnings: [warn] Scala version was updated by one of library dependencies: [warn] * org.scala-lang:scala-...
0
votes
1answer
37 views

Full path of production conf file in Windows

I'm trying to start the application in production mode with the following command: myapp.bat -Dconfig.resource=c:\mydir\prod\prod.conf I specified the full path of prod.conf but Play doesn't find it....
0
votes
2answers
250 views

How to implement SparkContext in Play for Scala

I have the following Play for Scala controller that wraps Spark. At the end of the method I close the context to avoid the problem of having more than one context active in the same JVM: class Test4 ...
-1
votes
1answer
106 views

Increasing memory of Play for Scala/Activator ~run

I'm running Play for Scala, and need to increase the heap/memory size as it runs out of memory when compiling. I see the following in activator.bat: rem TODO Check if there are existing mem settings ...
0
votes
1answer
327 views

Apache Flink: Class not resolvable through given classloader

I'm trying to consume some kafka topics through flink streams. Below is the code for the stream. object VehicleFuelEventStream { def sink[IN](hosts: String, table: String, ds: DataStream[IN]): ...
0
votes
1answer
45 views

java.lang.OutOfMemoryError embedding HDBSQL in Play

I'm using HSQLDB embedded in-memory in a Play for Scala application server. I configure the driver like so: driver = org.hsqldb.jdbc.JDBCDriver url = "jdbc:hsqldb:mem:inmemory" Also, when ...
3
votes
2answers
274 views

Dynamic path routing in Play for Scala

I have 300 entries defined in routes file, like so: GET /url001 MyClass.myMethod This works with URLs such as http://localhost:9000/url001 Now, I need to define two environments for these 300 links,...
0
votes
0answers
161 views

Strip string of hml tags in play framework

Is there a clever way to strip a string from all html tags in Play Framework (Java)? An alternative is to use tools like e.g. jSoup or regex, as suggested in Remove HTML tags from a String , but doesn'...
1
vote
1answer
72 views

Writing JSON depending on instance type

I have the following class structure in Play for Scala: sealed trait Father final case class Child1 (name: String, descrip: String) extends Father final case class Child2 (age: Int, price: Int) ...
0
votes
1answer
205 views

Connection not available in Play for Scala

I have the following configuration in application.conf for an in-memory database HSQLDB: db { inmemory { jndiName = jndiInMemory driver = org.hsqldb.jdbc.JDBCDriver url = "...
1
vote
0answers
21 views

Set JDBC properties on play-framework application.config

I'd like to set some JDBC properties on the application.config. For example: useLegacyDatetimeCode=false&useUnicode=true&serverTimezone=UTC And this is my application.config. play { db....
0
votes
1answer
44 views

Playframework [Scala]: Class not found in classpath in Play for Scala

I have added to build.sbt the Apache Derby jar: libraryDependencies += "org.apache.derby" % "derby" % "10.14.1.0" % Test I also ran activator update, which seemed to work fine. I need to embed ...
0
votes
0answers
45 views

Create a file in /public using dist file

I'm using Play 2.5 and I have written a code, in Java, to create a file in /app/public folder, I parametrized the path in application.conf. After that I created a dist file and when I tried to call ...
0
votes
1answer
87 views

How to get a thrown exception from MailerClient of Playframework

I'm working with Play-Mailer inside of a Play application. I'm able to send emails to correct email addresses. So far so good. - But with none existing email addresses an exception is thrown from org....
1
vote
1answer
936 views

NullPointerException in async action when converting from Play 2.4 to Play 2.5

I'm porting a Play 2.4 project to Play 2.5(.18). I'm running into a spurious NullPointerException I cannot find the reason for. This is the stack trace: ! @76g5ina3j - Internal server error, for (...
0
votes
1answer
46 views

Valid output types for play twirl template

What are the valid types that can be generated by a Twirl template in play framework? I know that I can generate HTML. I would like to generate an svg. Is that possible? If I have a file named ...
0
votes
1answer
54 views

Playframework 2.5 and Intellij IDEA

I am using IDEA for my Playframework development. However, I don't seem to be able to run/debug my application anymore I was able to do two months ago. I haven't done any active development on this ...
3
votes
0answers
180 views

Playframework always recompiles everything even just editing a css file

I use play framework 2.5.x in my project and it always recompiles everything of the project even when I only edit a static CSS file and refresh the page. The compilation is very slow now and it is ...
0
votes
1answer
30 views

Offer to queue with some initial display

I want to offer to queue a string sent in load request after some initial delay say 10 seconds. If the subsequent request is made with some short interval delay(1 second) then everything works fine, ...
-1
votes
1answer
41 views

Implementing user access to multiple Play instances

I have an application with the following characteristics: It's an online service offered to many companies. Each company uses a dedicated Play for Scala (Netty) application server. Each application ...
0
votes
1answer
149 views

Play Ebean does not generate Id after upgrading from 2.4 to 2.5

I am currently in the process of upgrading my application's play from 2.4.x to 2.5.18. By play's doc, I also upgraded play-ebean from 1.0.0 to 3.2.0, which uses ebean 10.4.x. After upgrading, whenever ...
1
vote
1answer
334 views

How to delete file right after processing it with Play Framework

I want to process a large local file with Play. The file should be deleted from the filesystem right after it's been processed. It would be easy using sendFile method like this: def index = Action { ...
1
vote
1answer
81 views

Setting up Play Framework 2.5.x with Hibernate OGM Neo4j

I am trying to setup Hibernate OGM to work with Play Framework 2.5.x(17) in my case but I keep getting "Cannot connect to database [default]" error. Apparantly Play takes MySQL driver as default and I ...
0
votes
2answers
727 views

How to use Messages via Dependency Injection in a Play Framework 2.6 app?

I'm migrating a Play web app to v2.6 and I'm having trouble understanding how dependency injection works with Messages considering that Messages are dependent on the HTTP context of the request. I ...
1
vote
1answer
400 views

How to create a Form<T> for a play (java) unit test now that Form.form() is deprecated?

In application code when dealing with forms it is recommended to use a FormFactory to create a Form wrapper around the form of type T. But when it comes to testing, what is the way to create a Form? (...
0
votes
1answer
101 views

Declaring non-default JNDI connection for JPA access in Play for Scala

The following snippet works in Play for Scala: class MyDAO @Inject() (jpaApi: JPAApi) { @Transactional def someMethod = { jpaApi.withTransaction { // .... In application.conf I ...
0
votes
2answers
96 views

JPA query in Play for Scala throws compilation error

I'm trying to implement a JPA query in Play for Scala. I took the information from here, but since the examples are in Java I'm probably mistaken. This is the code: class ManageBanks @Inject() (...
0
votes
1answer
76 views

Implementing JPA query in Play for Scala

I'm trying to implement JPA in Play for Scala, following these examples documented in Java. In the following code I get a compilation error in jpaApi.withTransaction: class ManageBanks @Inject() (...
0
votes
1answer
420 views

How can we call functions from other controllers in a play scala controller

In Play Scala 2.5 application, I define my controller like- class Application @Inject() (ws:WSClient) extends Controller{ Now, I want to call a function readConfig() of another controller class- ...
0
votes
1answer
166 views

Scala Play 2.5 Controller class to serve static HTML

I want to serve a static file from a Scala Play controller. I am looking for something that would allow me to do something like this example below. NOTE: This obviously does not work. It is very ...
2
votes
0answers
293 views

How to log all requests and responses for Play Framework 2.5.x?

I want to log requests and responses for my application. I expect they should be present in access.log file. However, my access.log file is empty. I have enables access logging in configuration. Here ...