Giter VIP home page Giter VIP logo

play-scala-anorm-example's Introduction

play-scala-anorm-example's People

Contributors

cchantep avatar dwijnand avatar gmethvin avatar kipsigman avatar marcospereira avatar markusjura avatar octonato avatar richdougherty avatar rmcloughlin avatar sullis avatar wsargent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-scala-anorm-example's Issues

Deadlock in "sbt run" when using Netty as a server

There is no problem when using Akka HTTP server, but after switching to Netty, when I run sbt run (development mode) the first page shown is Database 'default' needs evolution!.
After clicking Apply this script now! application hangs.

Internally there is a deadlock.
One thread (play-dev-mode-akka.actor.default-dispatcher-<n>) is inside this synchronized block waiting for this asynchronous instruction to finish and another thread (netty-event-loop-<n>) trying to enter the same synchronized block.

Here is the repo showing this problem. Just execute sbt run. My execution log is here.

Tests & Application fail with AnormException: ColumnName(COMPUTER.NAME,Some(NAME))]

Cloning the repo and running either activator test (or activator new) results in AnormException:

[info] Compiling 3 Scala sources to /Users/hakan/Workspaces/Learning/Play/play-anorm/target/scala-2.11/test-classes...
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-0 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] ModelSpec:
[info] Computer model
[info] - should be retrieved by id
[info] - should be listed along its companies
[info] - should be updated if needed
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-0 - is closing down.
[info] IntegrationSpec:
[info] Application
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-1 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[error] application -

! @70490j46c - Internal server error, for (GET) [/computers] ->

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[AnormException: ColumnName(COMPUTER.NAME,Some(NAME))]]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:280)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:206)
    at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
    at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
    at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:98)
    at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
    at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Caused by: anorm.AnormException: ColumnName(COMPUTER.NAME,Some(NAME))
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-1 - is closing down.
[info] - should work from within a browser *** FAILED ***
[info]   org.openqa.selenium.NoSuchElementException: Element not found
[info] For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
[info] Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
[info] System info: host: 'HMBP.local', ip: '192.168.1.50', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_77'
[info] Driver info: driver.version: unknown
[info]   at org.fluentlenium.core.domain.FluentListImpl.first(FluentListImpl.java:27)
[info]   at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(IntegrationSpec.scala:16)
[info]   at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(IntegrationSpec.scala:13)
[info]   at play.api.test.PlayRunners$class.running(Helpers.scala:99)
[info]   at play.api.test.Helpers$.running(Helpers.scala:382)
[info]   at play.api.test.PlayRunners$class.running(Helpers.scala:87)
[info]   at play.api.test.Helpers$.running(Helpers.scala:382)
[info]   at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(IntegrationSpec.scala:13)
[info]   at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(IntegrationSpec.scala:13)
[info]   at IntegrationSpec$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(IntegrationSpec.scala:13)
[info]   ...
[info] FunctionalSpec:
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-2 - is starting.
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] HomeController
[info] - should redirect to the computer list on /
[info] - should list computers on the the first page *** FAILED ***
[info]   anorm.AnormException: ColumnName(COMPUTER.NAME,Some(NAME))
[info]   ...
[info] - should filter computer by name
[info] - should create new computer
[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-2 - is closing down.
[info] ScalaTest
[info] Run completed in 11 seconds, 896 milliseconds.
[info] Total number of tests run: 8
[info] Suites: completed 3, aborted 0
[info] Tests: succeeded 6, failed 2, canceled 0, ignored 0, pending 0
[info] *** 2 TESTS FAILED ***
[error] Failed: Total 8, Failed 2, Errors 0, Passed 6
[error] Failed tests:
[error]     IntegrationSpec
[error]     FunctionalSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 26 s, completed May 13, 2016 12:39:45 PM

Update to 2.3.x

Is there a plans for updating this sample to 2.3.x branch?

Remove injection into SQL statement

https://github.com/playframework/play-scala-anorm-example/blob/2.6.x/app/controllers/HomeController.scala#L57

  def list(page: Int, orderBy: Int, filter: String) = Action.async { implicit request =>
    computerService.list(page = page, orderBy = orderBy, filter = ("%" + filter + "%")).map { page =>
      Ok(html.list(page, orderBy, filter))
    }
  }

https://github.com/playframework/play-scala-anorm-example/blob/2.6.x/conf/routes#L9

GET     /computers                  controllers.HomeController.list(p:Int ?= 0, s:Int ?= 2, f ?= "")

means that you can inject your own filter by using an "f" query parameter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.