Erro ao compilar o projecto com Spring

1 resposta
springspring-boot
Ayrton_Satar1996

Boas colegas, estou a seguir umas vídeos aulas relacionada com a criação de um projecto usando projectos spring até agora estava funcionando apenas tinha que fazer algumas configurações extras, mas desta vez quando fui a compilar o projecto deparo-me com um erro. Abaixo deixo a descrição do erro e a minha configuração do maven e do spring. O que posso fazer para resolver o meu problema?

Configuração do Spring
#thymeleaf
spring.thymeleaf.mode= HTML
spring.thymeleaf.cache=false

server.port=8081

#spring data
spring.datasource.url=jdbc:mysql://localhost/tw_gerenciador_tarefas
spring.datasource.username=root
spring.datasource.password=123456
spring.jpa.hibernate.ddl_auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

configuração do Maven

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.7.RELEASE</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>
	<groupId>br.com.treinaweb</groupId>
	<artifactId>tw-gerenciador-tarefas</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>tw-gerenciador-tarefas</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<java.version>1.8</java.version>

	</properties>

	<dependencies>
		<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<!-- <dependency> -->
		<!-- <groupId>org.springframework.boot</groupId> -->
		<!-- <artifactId>spring-boot-starter-security</artifactId> -->
		<!-- </dependency> -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-test</artifactId>
			<scope>test</scope>
		</dependency>
		<!-- WebJars -->
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>webjars-locator</artifactId>
			<version>0.36</version>
		</dependency>
		
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>jquery</artifactId>
			<version>3.4.1</version>
		</dependency>
		
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>bootstrap</artifactId>
			<version>4.3.1</version>
		</dependency>


	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

O erro:
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 18.640 s
> [INFO] Finished at: 2019-09-02T07:57:45+02:00
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:run (default-cli) on project tw-gerenciador-tarefas: An exception occurred while running. null: InvocationTargetException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution: The server time zone value ‘Hora padr?o da ?frica do Sul’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please read the following articles:
> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

1 Resposta

Ayrton_Satar1996

Consegui resolver o meu erro configurando a url da base dados.
spring.datasource.url=jdbc:mysql://localhost/tw_gerenciador_tarefas?serverTimezone=UTC&useLegacyDatetimeCode=false

Criado 2 de setembro de 2019
Ultima resposta 2 de set. de 2019
Respostas 1
Participantes 1