我有一個Actor(Play Framework,Java),用於定期執行一些數據庫數據導入。這位演員調用各種其他類,進行導入,堅持等等。我目前的問題是,我無法弄清楚生成SQL異常的確切行號和文件。舉例來說,我得到的錯誤是這樣的:找出哪一行代碼正在生成SQL異常
[info] application - javax.persistence.PersistenceException: ERROR executing DML bindLog[] error[ERROR: null value in column "email" violates not-null constraint\n Detail: Failing row contains (266, null, null, null).]
[info] application - Starting persisting of customer id 29917837
[error] o.j.StatementLogger - insert into emails (email, domain, user_id) values (null,null,null);
throws exception: org.postgresql.util.PSQLException: ERROR: null value in column "email" violates not-null constraint
Detail: Failing row contains (268, null, null, null).
org.postgresql.util.PSQLException: ERROR: null value in column "email" violates not-null constraint
Detail: Failing row contains (268, null, null, null).
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:645)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:495)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:441)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
當然,我可以看看錯誤信息,並看到一些地方試圖堅持我的電子郵件模型,而不會填充它。現在代碼庫非常小(大約200-300行),我可以很準確地猜出這是從哪裏來的。但是框架不應該報告行號?或者,也許這就是使用演員時會發生的情況,因爲他們在某種程度上是種類的,在系統之外,還有一切?
事實上,你的大部分類都有行號(編譯的java代碼中的行號是可選的)。但是,這是你的整個堆棧跟蹤?哪個方法使用反射來調用HikariProxyPreparedStatement? –
@SergioMontoro是的,這是整個堆棧跟蹤。實際上我使用Play框架,它使用Akka actors來安排任務。除此之外,我不知道誰在做什麼,但似乎這個框架正在使用反射。 – dotslash