今日、私は Ebean と play2.0 に小さな問題があります。de.ppi.psec.services.AuthenticationServiceImpl 行 333 のようなものを書きました
Ebean.find(PsecUser.class).where().eq("byLoginname", loginname).findUnique();
次のスタックトレースを取得します
[error] application - Problem during validate Login
javax.persistence.PersistenceException: Query threw SQLException:Feld "BYLOGINNAME" nicht gefunden
Column "BYLOGINNAME" not found; SQL statement:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ? [42122-158]
Bind values:[null]
Query was:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ?
at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:849) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:829) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:238) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:104) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:344) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1469) ~[ebean.jar:na]
Caused by: org.h2.jdbc.JdbcSQLException: Feld "BYLOGINNAME" nicht gefunden
Column "BYLOGINNAME" not found; SQL statement:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ? [42122-158]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) ~[h2.jar:1.3.158]
at org.h2.message.DbException.get(DbException.java:169) ~[h2.jar:1.3.158]
at org.h2.message.DbException.get(DbException.java:146) ~[h2.jar:1.3.158]
at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:134) ~[h2.jar:1.3.158]
at org.h2.expression.Comparison.optimize(Comparison.java:154) ~[h2.jar:1.3.158]
at org.h2.command.dml.Select.prepare(Select.java:797) ~[h2.jar:1.3.158]
[error] application -
! @6aagbfped - Internal server error, for request [POST /login] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[RuntimeException: java.lang.reflect.InvocationTargetException]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.1]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.1]
at akka.actor.Actor$class.apply(Actor.scala:311) [akka-actor.jar:2.0.1]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.1]
at akka.actor.ActorCell.invoke(ActorCell.scala:619) [akka-actor.jar:2.0.1]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196) [akka-actor.jar:2.0.1]
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at play.data.Form.bind(Form.java:225) ~[play_2.9.1.jar:2.0.1]
at play.data.Form.bindFromRequest(Form.java:145) ~[play_2.9.1.jar:2.0.1]
at controllers.psec.AuthController.signIn(AuthController.java:48) ~[psec_2.9.1.jar:0.1]
at Routes$$anonfun$routes$1$$anonfun$apply$17$$anonfun$apply$18.apply(routes_routing.scala:132) ~[classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$17$$anonfun$apply$18.apply(routes_routing.scala:132) ~[classes/:na]
at play.core.Router$HandlerInvoker$$anon$4$$anon$1.invocation(Router.scala:1086) ~[play_2.9.1.jar:2.0.1]
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_31]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.6.0_31]
at play.data.Form.bind(Form.java:222) ~[play_2.9.1.jar:2.0.1]
at play.data.Form.bindFromRequest(Form.java:145) ~[play_2.9.1.jar:2.0.1]
Caused by: javax.persistence.PersistenceException: Query threw SQLException:Feld "BYLOGINNAME" nicht gefunden
Column "BYLOGINNAME" not found; SQL statement:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ? [42122-158]
Bind values:[null]
Query was:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ?
at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:849) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.CQuery.createPersistenceException(CQuery.java:829) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:238) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:104) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:344) ~[ebean.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1469) ~[ebean.jar:na]
Caused by: org.h2.jdbc.JdbcSQLException: Feld "BYLOGINNAME" nicht gefunden
Column "BYLOGINNAME" not found; SQL statement:
select t0.id c0, t0.loginname c1, t0.email_address c2, t0.lastname c3, t0.firstname c4, t0.description c5, t0.enabled c6, t0.login_failed_count c7, t0.expired_date c8, t0.password c9, t0.last_update c10
from psec_user t0
where byLoginname = ? [42122-158]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) ~[h2.jar:1.3.158]
at org.h2.message.DbException.get(DbException.java:169) ~[h2.jar:1.3.158]
at org.h2.message.DbException.get(DbException.java:146) ~[h2.jar:1.3.158]
at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:134) ~[h2.jar:1.3.158]
at org.h2.expression.Comparison.optimize(Comparison.java:154) ~[h2.jar:1.3.158]
at org.h2.command.dml.Select.prepare(Select.java:797) ~[h2.jar:1.3.158]
スタックトレースで自分のクラスが見つからなかった理由が不思議です。古い Ebean アプリで同様のことを試してみたところ、情報が得られました。スタックトレースで自分のクラスが見つからないのはなぜですか? 問題を解決したので、エラーは de.ppi.psec.services.AuthenticationServiceImpl 行 333 にあると確信しています。