无法抓住Throwable - JPA + Glassfish

时间:2017-04-05 10:41:58

标签: java mysql jpa glassfish

我被赋予了在 Glassfish 上运行的耳朵项目,并与 JPA + mysql 一起使用。 现在,在glassfish日志中,我得到了大量的例外(例如我缩短了堆栈跟踪):

[2017-04-05T13:24:40,584] [http-listener-1(5)] WARN  No projects were found
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'project_version_id_version' in 'field list'
Error Code: 1054
Call: SELECT project_version_id_version, project_version_id_project FROM anthillprodashboard.project_version WHERE (project_version_id_project = ?)
    bind => [1 parameter bound]
Query: ReadAllQuery(name="ProjectVersion.findAllByProject" referenceClass=ProjectVersion sql="SELECT project_version_id_version, project_version_id_project FROM anthillprodashboard.project_version WHERE (project_version_id_project = ?)")
    at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:382) ~[org.eclipse.persistence.jpa.jar:?]
    ... A lot more lines ...
    at com.sun.proxy.$Proxy254.getAllVersionsForProject(Unknown Source) [?:?]
    at **com.valor.anthillprodashboard.ui.page.AdminPage.generateVersionDualList(AdminPage.java:245)** [AdminPage.class:?]
    ... A lot more lines ...
    at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258) ~[org.eclipse.persistence.jpa.jar:?]
    ... 116 more]]

现在,有趣的是,在第245行,就像堆栈跟踪建议的那样,我有这段代码:

try {
     versionsForProject = this.dataAccessFacade.getAllVersionsForProject(this.currentProjectForVersion);
}
catch (Throwable e){
    versionsForProject = null;
}

假设要处理每个可能的异常/错误。

所以,我的问题是如何或者究竟是谁给了我这些例外?我该如何处理它们?

0 个答案:

没有答案