Reputation: 4426
I'm developping an application using Play2 and Ebean as ORM. I am unable to start my application because of the following error :
[warn] c.a.e.s.c.DefaultServer - JMX beans for Ebean server [default] already registered. Will try unregister/registerEbean:server=default2,function=Logging
[warn] c.a.ebean.Ebean - Existing EbeanServer [default] is being replaced?
[error] application -
! @6f14elgpb - Internal server error, for (GET) [/] ->
play.api.UnexpectedException: Unexpected exception[NullPointerException: null]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:150) ~[play_2.10.jar:2.1.2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:114) ~[play_2.10.jar:2.1.2]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:114) ~[play_2.10.jar:2.1.2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10.jar:2.1.2]
at scala.util.Either$RightProjection.flatMap(Either.scala:523) ~[scala-library.jar:na]
Caused by: java.lang.NullPointerException: null
at com.avaje.ebeaninternal.server.ddl.CreateTableVisitor.isDbColumnWritten(CreateTableVisitor.java:58) ~[avaje-ebeanorm-server.jar:na]
at com.avaje.ebeaninternal.server.ddl.CreateTableColumnVisitor.visitOneImported(CreateTableColumnVisitor.java:117) ~[avaje-ebeanorm-server.jar:na]
at com.avaje.ebeaninternal.server.ddl.VisitorUtil.visit(VisitorUtil.java:109) ~[avaje-ebeanorm-server.jar:na]
at com.avaje.ebeaninternal.server.ddl.VisitorUtil.visit(VisitorUtil.java:73) ~[avaje-ebeanorm-server.jar:na]
at com.avaje.ebeaninternal.server.ddl.VisitorUtil.visitBean(VisitorUtil.java:62) ~[avaje-ebeanorm-server.jar:na]
at com.avaje.ebeaninternal.server.ddl.VisitorUtil.visit(VisitorUtil.java:36) ~[avaje-ebeanorm-server.jar:na]
[trace] play - No handler, got direct result: SimpleResult(500, Map(Content-Type -> text/html; charset=utf-8))
I don't understand what's happening, the server is starting well, I tried to restart mysql but nothing changed. It seems to be a bug from the Ebean DDL generator but how can I debug it ?
Thanks for your help.
EDIT : If i disable evolution plugin in application.conf
# Evolutions
# ~~~~~
# You can disable evolutions if needed
evolutionplugin=disabled
my application starts (but the database is not updated...)
EDIT 2 : I activated TRACE log at application level and updated the stacktrace, what about the following lines :
[warn] c.a.e.s.c.DefaultServer - JMX beans for Ebean server [default] already registered. Will try unregister/registerEbean:server=default2,function=Logging
[warn] c.a.ebean.Ebean - Existing EbeanServer [default] is being replaced?
Upvotes: 1
Views: 1638
Reputation: 4426
Ok I've found where the problem is. I have a Customer entity having this field with the annotations :
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(unique = true)
@NotNull
public User user;
If I add name = "user_id",
in the JoinColumn annotation, the error does not happen anymore... So this works :
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "user_id", unique = true)
@NotNull
public User user;
But in all cases, the unique constraint on my user_id column is not applied in the database. Do one of you have an idea ? Is it a limitation of Ebean ?
Thanks.
Upvotes: 2