INATrace / backend

GNU Affero General Public License v3.0
5 stars 3 forks source link

DataSource error during application startup #1

Open acjacjacj opened 1 year ago

acjacjacj commented 1 year ago

Hi,

I'm trying to set up a testing instance of the full INATrace application. I'm sure I followed the instructions for a local enviroment, but I keep getting a Spring error when trying to start the back-end. It says something about the datasource not being determinable. It is however set in the "application.properties" file, with the same values as the readme guide.

This is my readable error: ina-trace_1 | ina-trace_1 | APPLICATION FAILED TO START ina-trace_1 | ina-trace_1 | ina-trace_1 | Description: ina-trace_1 | ina-trace_1 | Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. ina-trace_1 | ina-trace_1 | Reason: Failed to determine a suitable driver class ina-trace_1 | ina-trace_1 | ina-trace_1 | Action: ina-trace_1 | ina-trace_1 | Consider the following: ina-trace_1 | If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. ina-trace_1 | If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

This is my logged error stack trace:

Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

MBJuric commented 1 year ago

Hi, It looks like you have not configured the datasource URL. Depending on which database you use, you have to specify the JDBC DataSource connection URL. For example, if you will use PostgreSQL, the connections string would be: jdbc:postgresql://host:port/database (You have to specify the host and port, on which the database is located, and the database name). Prior to that you have to install and configure the database and create the tables.

acjacjacj commented 1 year ago

Hi MBJuric,

Thanks for your response. I was using my own Mysql 8 container and hadn't created the neccessary database yet. My colleague has the back-end working now so it's resolved!