Open chrishmorris opened 6 years ago
Hi Chris have tried to run it directly with maven ?
Another issue cold be that the project need a mysql server configured, if you want I can add a test configuration that use H2 database
regards Andrea
On 21 Feb 2018, at 16:42, Chris Morris notifications@github.com wrote:
If the database connection fails, this is reported as a stack trace hundreds of lines long.
There should be a clear report in the UI, because this will happen one day.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/h2020-westlife-eu/wp6-repository/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AMaWiRhq9dwdBs2AnsQyg71NkUTvH1zMks5tXDl2gaJpZM4SN2kl.
These are both good ideas that would make it easier for developers.
The issue raised is different: from time to time, in production, the application will fail. Clear error messages are required. IN other words, system administrators are stakeholders too.
Some of the REST services are not depended on DB. But in case of DB connection failure for any reason, no REST service is available. Currently HTTP 503 is returned, we may return better status code and message e.g. with the e.getMessage().
Hi in dev-andrea-new I have added the exception handler for DB connection problem, if you needed i can mange also the other exception
On 08 Mar 2018, at 13:03, Tomas Kulhanek notifications@github.com wrote:
Some of the REST services are not depended on DB. But in case of DB connection failure for any reason, no REST service is available. Currently HTTP 503 is returned, we may return better status code and message e.g. with the e.getMessage().
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/h2020-westlife-eu/wp6-repository/issues/28#issuecomment-371468141, or mute the thread https://github.com/notifications/unsubscribe-auth/AMaWies1U8agWJGJaQSV7pL2RHNcciznks5tcR4ZgaJpZM4SN2kl.
Hi Andrea,
I made major merge to master branch, so you may merge it to your working branch.
Could you, please, explain changes you did and how to use it? I see new file error.jsp. But it is not rendered. I tried to start the backend of dev-andrea-new branch with wrong DB configuration. Going to http://localhost:8080/repositorytest/restcon/user the following is returned
HTTP ERROR: 503 Problem accessing /admin/restcon/user. Reason: Service Unavailable
Powered by Jetty:// 9.3.18.v20170406http://eclipse.org/jetty
And server log contains a lot of stacktrace: ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) … at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method)
Tomas
From: Andrea Giachetti [mailto:notifications@github.com] Sent: 09 March 2018 14:39 To: h2020-westlife-eu/wp6-repository Cc: Kulhanek, Tomas (STFC,DL,SC); Comment Subject: Re: [h2020-westlife-eu/wp6-repository] Operability: report DB connection issue (#28)
Hi in dev-andrea-new I have added the exception handler for DB connection problem, if you needed i can mange also the other exception
The @ExceptionHandler(CannotCreateTransactionException.class) capture the exception CannotCreateTransactionConnection that are raised if the DB are stopped To test it can you tray to start normally the site and after that stop the database service
If you put bad database credential and start the service you receive:
INFO : org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.1.3.Final INFO : org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update INFO : org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:926) .... .... .... 09-Mar-2018 16:50:16.756 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file ERROR: org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceInitializer' defined in class path resource [org/cirmmp/spring/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.UncategorizedScriptException: Failed to execute database script; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
but the container doesn't start and I cannot mange the exception
On 09 Mar 2018, at 16:11, Tomas Kulhanek notifications@github.com wrote:
Hi Andrea,
I made major merge to master branch, so you may merge it to your working branch.
Could you, please, explain changes you did and how to use it? I see new file error.jsp. But it is not rendered. I tried to start the backend of dev-andrea-new branch with wrong DB configuration. Going to http://localhost:8080/repositorytest/restcon/user the following is returned
HTTP ERROR: 503 Problem accessing /admin/restcon/user. Reason: Service Unavailable
Powered by Jetty:// 9.3.18.v20170406http://eclipse.org/jetty
And server log contains a lot of stacktrace: ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) … at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method)
Tomas
From: Andrea Giachetti [mailto:notifications@github.com] Sent: 09 March 2018 14:39 To: h2020-westlife-eu/wp6-repository Cc: Kulhanek, Tomas (STFC,DL,SC); Comment Subject: Re: [h2020-westlife-eu/wp6-repository] Operability: report DB connection issue (#28)
Hi in dev-andrea-new I have added the exception handler for DB connection problem, if you needed i can mange also the other exception
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/h2020-westlife-eu/wp6-repository/issues/28#issuecomment-371839795, or mute the thread https://github.com/notifications/unsubscribe-auth/AMaWidplzfSNuDO4-rQMINPWfbq2nZs7ks5tcpuKgaJpZM4SN2kl.
If the database connection fails, this is reported as a stack trace hundreds of lines long.
There should be a clear report in the UI, because this will happen one day.