Errors in OpenATNA and OpenNCP Gateway Portal
We have seen the following errors in OpenATNA and OpenNCP Gateway Portal log files. We are running Openncp 6.3.1 and our database is Oracle.
OpenATNA startup with Hibernate property in openatna.properties: hib.hbm2ddl.auto=validate
Annotation @Type(type = "org.hibernate.type.BinaryType") in OpenATNA entity classes does not work with Oracle
2023-09-13 14:01:46.553 [main] ERROR o.o.o.w.OpenATNAServiceLoaderListener.start(28) - Unable to start AuditService: 'Error creating bean with name 'codeDao' defined in class path resource [openatnaContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [openatnaContext.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [payload] in table [errors]; found blob (Types#BLOB), but expecting raw(255) (Types#VARBINARY)' org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'codeDao' defined in class path resource [openatnaContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [openatnaContext.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [payload] in table [errors]; found blob (Types#BLOB), but expecting raw(255) (Types#VARBINARY)
OpenNCP Gateway Portal
Try to open eADC Viewer
2023-09-15 12:55:32.307 [http-nio-8090-exec-6] INFO e.e.e.s.e.o.g.m.e.TransactionResource.getTransactions(38) - [API] Listing eADC Transactions
2023-09-15 12:55:32.316 [http-nio-8090-exec-8] WARN o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions(137) - SQL Error: 904, SQLState: 42000
2023-09-15 12:55:32.316 [http-nio-8090-exec-8] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions(142) - ORA-00904: "YEAR": invalid identifier2023-09-15 12:55:32.320 [http-nio-8090-exec-8] ERROR o.s.b.w.s.support.ErrorPageFilter.forwardToErrorPage(184) - Forwarding to error page from request [/api/eadc/transactions/getYears] due to exception [could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet]
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)
...
at com.sun.proxy.$Proxy163.findAllYears(Unknown Source)
at eu.europa.ec.sante.ehdsi.openncp.gateway.module.eadc.TransactionService.getYears(TransactionService.java:36)
at eu.europa.ec.sante.ehdsi.openncp.gateway.module.eadc.TransactionServiceFastClassBySpringCGLIB
b6dc6f81.invoke()
...
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
...
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "YEAR": invalid identifier at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
...
Changing @Query in eu.europa.ec.sante.ehdsi.openncp.gateway.module.eadc.persistence.repository.TransactionRepository as follows solves this problem:
select distinct trim(substr(t.startTime, 12, 5)) as year from Transaction t where trim(substr(t.startTime, 12, 5)) IS NOT NULL order by trim(substr(t.startTime, 12, 5)) desc
eADC Viewer / Transactions / try to sort by 'Error description'
2023-09-15 12:56:22.861 [http-nio-8090-exec-5] ERROR o.s.b.w.s.support.ErrorPageFilter.forwardToErrorPage(184) - Forwarding to error page from request [/api/eadc/transactions] due to exception [No property 'errorDescription' found for type 'Transaction']
org.springframework.data.mapping.PropertyReferenceException: No property 'errorDescription' found for type 'Transaction'
at org.springframework.data.mapping.PropertyPath.(PropertyPath.java:91)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:438)
...
at com.sun.proxy.$Proxy163.findAll(Unknown Source)
at eu.europa.ec.sante.ehdsi.openncp.gateway.module.eadc.TransactionService.findTransactions(TransactionService.java:27)
at eu.europa.ec.sante.ehdsi.openncp.gateway.module.eadc.TransactionServiceFastClassBySpringCGLIB
b6dc6f81.invoke()
...
ATNA Viewer / Error Messages
2023-09-18 11:27:08.361 [http-nio-8090-exec-4] WARN o.s.w.s.m.s.DefaultHandlerExceptionResolver.logException(208) - Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.springframework.data.domain.PageImpl["content"]}>java.util.Collections$UnmodifiableRandomAccessList[4]{>eu.europa.ec.sante.ehdsi.openncp.gateway.module.atna.persistence.model.Error["payload"])]
2023-09-18 11:27:08.362 [http-nio-8090-exec-4] ERROR o.s.b.w.s.support.ErrorPageFilter.handleCommittedResponse(219) - Cannot forward to error page for request [/api/atna/errors] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false