Skip to content

Instantly share code, notes, and snippets.

@schmmd
Created July 7, 2012 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmmd/3063509 to your computer and use it in GitHub Desktop.
Save schmmd/3063509 to your computer and use it in GitHub Desktop.
Akka error in Play 2.0.2
This error occurred when upgrading to Play 2.0.2. The same code works in Play 2.0.1.
# This is the main configuration file for the application.
# ~~~~~
# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="ZVl:GeHGRZv_i1o[Q@wh@S=0L>]69;s2ACK[gLDy<;^EBhxS[r5Gl5@DSbdv;8GV"
# The application languages
# ~~~~~
application.langs="en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# global=Global
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
# Root logger:
logger.root=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG
akka {
remote.netty.message-frame-size = 100 MiB
actor {
provider = "akka.remote.RemoteActorRefProvider"
typed {
# Default timeout for typed actor methods with non-void return type
timeout = 120s
}
}
remote {
transport = "akka.remote.netty.NettyRemoteTransport"
netty {
hostname = "127.0.0.1"
port = 9002
}
}
}
package controllers
import play.api.Play.current
import play.api.cache.Cache
import play.api.data.Forms.{ text, optional, mapping }
import play.api.data.Form
import play.api.mvc.{ Controller, Action }
import play.api.Logger
import play.api.libs.concurrent
import scala.util.control.Exception
import sjson.json.JsonSerialization.tojson
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.DateTimeFormat
object Application extends Controller {
def index() = Action {
val answers = concurrent.Akka.future {
4 + 5
}
Ok("Food")
}
/*
def doSearch(query: Query, filterString: String, pageNumber: Int, debug: Boolean = false, log: Boolean = true, justResults: Boolean = false) = {
val answers = concurrent.Akka.future {
searchGroups(query, debug)
}
Async {
answers.orTimeout("Query timeout after " + maxQueryTime + " ms due to high server load.", maxQueryTime).map {
case Right(timeout) => Logger.warn(query.toString + "timed out after " + maxQueryTime + " ms"); InternalServerError(timeout)
case Left((answers, message)) =>
val filters: Set[TypeFilter] = filterString match {
case "" | "all" => Set()
case "misc" => answers.filters.map(_.filter).collect { case filter: PositiveTypeFilter => filter } .map(filter => NegativeTypeFilter(filter.typ, query.freeParts)).toSet
case s => Set(PositiveTypeFilter(FreeBaseType.parse(s).getOrElse(throw new IllegalArgumentException("invalid type string: " + s)), query.freeParts))
}
val filtered = answers filter filters
Logger.info(query + " with " + filters + " has " + filtered.answerCount + " answers " + filtered.sentenceCount + " results")
val page = filtered.page(pageNumber, PAGE_SIZE)
if (log) {
val entry = new LogEntry(query, answers.answerCount, answers.sentenceCount)
entry.log()
}
if (justResults) {
Ok(views.html.results(query, page, filters.toSet, filterString, pageNumber, math.ceil(filtered.answerCount.toDouble / PAGE_SIZE.toDouble).toInt, MAX_SENTENCE_COUNT, debug))
} else {
Ok(
views.html.frame.resultsframe(
searchForm, query, message, page, filtered.answerCount, filtered.sentenceCount)(
views.html.results(query, page, filters.toSet, filterString, pageNumber, math.ceil(filtered.answerCount.toDouble / PAGE_SIZE.toDouble).toInt, MAX_SENTENCE_COUNT, debug)))
}
}
}
}
*/
}
sbt.version=0.11.3
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "playtest"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
"com.typesafe.akka" % "akka-remote" % "2.0.2"
)
val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
// Add your own project settings here
)
}
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.0.2")
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment