Re: [play-framework] Re: [2.4.0-RC1] [play-java] Ebean ORM not working

432 views
Skip to first unread message

Marcos Pereira

unread,
Apr 24, 2015, 8:54:42 AM4/24/15
to play-fr...@googlegroups.com

Could you please share this project with us?

I will take a look an try to figure out what is happening.

Best,


On Fri, Apr 24, 2015, 04:13 Nicolaas Frederick Huysamen <nico.h...@gmail.com> wrote:
Just removed my entire ivy cache and let everything pull in again, still the same issues.


On Friday, 24 April 2015 08:33:44 UTC+2, Nicolaas Frederick Huysamen wrote:
With the release of RC1 this morning, I thought I would give it a spin, but I cannot get Ebean to work. As per the migration guide, from a newly created play-java project with:

activator new myproject play-java

  1. build.sbt
    1. bump scalaVersion to 2.11.6
    2. remove javaEbean from libraryDependencies
    3. add mysql-connector-java as dependency
    4. added injected router config
  2. project/build.properties
    1. bump sbt version to 0.13.8
  3. project/plugins.sbt
    1. bumped sbt-plugin version to 2.4.0-RC1
    2. added sbt-play-ebean version 2.4.0-RC1
  4. controllers/Application.java
    1. removed static modifier from index()
At this point, the application still works fine. However, starting with the database stuff:
  1. conf/application.conf
    1. add all the database connection details
    2. uncomment default ebean server line to read models.*
  2. models/User.java
    1. create a simple User model class
At this point, there are no implementations of the Model class available. I would have thought the ebean plugin would pull in the required ajave-ebeanorm dependencies, but for some reason it does not (maybe this is just my machine...).

So, including the ajave-ebeanorm dependency in build.sbt solves this issue. Starting the application is no problem, until I try to persist an entity, at which point:

Caused by: java.lang.NullPointerException: null
        at com.avaje.ebean.Model.save(Model.java:122) ~[avaje-ebeanorm-4.2.0.jar:na]
        at models.User.create(User.java:54) ~[na:na]
        at Global.onStart(Global.java:12) ~[na:na]
        at play.core.j.JavaGlobalSettingsAdapter.onStart(JavaGlobalSettingsAdapter.scala:22) ~[play_2.11-2.4.0-RC1.jar:2.4.0-RC1]
        at play.api.GlobalPlugin.onStart(GlobalSettings.scala:272) ~[play_2.11-2.4.0-RC1.jar:2.4.0-RC1]
        at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ~[play_2.11-2.4.0-RC1.jar:2.4.0-RC1]
        at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ~[play_2.11-2.4.0-RC1.jar:2.4.0-RC1]
        at scala.collection.Iterator$class.foreach(Iterator.scala:750) ~[scala-library-2.11.6.jar:na]
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1202) ~[scala-library-2.11.6.jar:na]
        at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) ~[scala-library-2.11.6.jar:na]

Am I doing something obviously wrong here?

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolaas Frederick Huysamen

unread,
Apr 24, 2015, 9:13:54 AM4/24/15
to play-fr...@googlegroups.com
No worries, I got it running. Where was some information missing in the migration guide that was present in the new 2.4.0-RC1 docs, namely that you need to add SbtEbean to the build.sbt as en enabled plugin. Thanks though!

Miel Soeterbroek

unread,
May 4, 2015, 12:09:51 AM5/4/15
to play-fr...@googlegroups.com
Struggled a while to get this working properly. The issue i kept on running into was an unresolved dependency on the sbt-play-ebean plugin.
In your post you refer to it with version "2.4.0-RC1", that's presumably a typo. Tried it with 1.0.0, as per the migration guide. No luck either. The only one that resolved for me was 1.0.0-RC1:

addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0-RC1")

Thought i'd mention it, in case others have similar issues.

Nicolaas Frederick Huysamen

unread,
May 4, 2015, 1:40:42 AM5/4/15
to play-fr...@googlegroups.com
Yeah sorry, that was a typo, it should be 1.0.0-RC1. But my issue was adding SbtEbean to the plugin list in the build.sbt.
Reply all
Reply to author
Forward
0 new messages