250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- AJAX
- 오픈소스
- SpringBoot
- spring
- Open Source
- Tomcat
- MySQL
- Source
- Python
- myBatis
- 설정
- Core Java
- Thymeleaf
- error
- oracle
- maven
- JDBC
- git
- Spring Boot
- Eclipse
- JavaScript
- jpa
- ubuntu
- STS
- IntelliJ
- Exception
- MSSQL
- PostgreSQL
- Docker
- 문서
Archives
- Today
- Total
헤르메스 LIFE
[WARN] Cannot find template location: classpath:/templates/ 본문
728x90
게시판을 작성해보려 합니다. 조금씩 살을 붙여나가 보려고 합니다.
개발환경
Spring Boot 2.7.9
lombok
devtools
postgresql
Gladle
Thymeleaf
아래와 같은 경고가 발생했습니다.
2023-04-12T23:16:10.277+09:00[0;39m [33m WARN[0;39m [35m19420[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mion$DefaultTemplateResolverConfiguration[0;39m [2m:[0;39m Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
[2m2023-04-12T23:16:10.301+09:00[0;39m [33m WARN[0;39m [35m19420[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mConfigServletWebServerApplicationContext[0;39m [2m:[0;39m Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
[2m2023-04-12T23:16:10.303+09:00[0;39m [32m INFO[0;39m [35m19420[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Stopping service [Tomcat]
[2m2023-04-12T23:16:10.315+09:00[0;39m [32m INFO[0;39m [35m19420[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.b.a.l.ConditionEvaluationReportLogger[0;39m [2m:[0;39m
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2m2023-04-12T23:16:10.329+09:00[0;39m [31mERROR[0;39m [35m19420[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter [0;39m [2m:[0;39m
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
첫번째 문제는 Thymeleaf 문제 입니다.
Thymeleaf 환경은 templates 폴더가 존재해야 하는 모양입니다.
아래와 같이 폴더를 추가했습니다.
src/main/resources/templates 폴더 추가
src/main/resources/static 폴더 추가
templates 폴더를 사용하지 않으려면 아래와 같은 설정을 추가하면 된다고 가이드를 보여주네요.
spring.thymeleaf.check-template-location=false
Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
두번째 문제는 DB 문제 입니다.
Dependency에 다음과 같은 설정이 있기때문에, DB를 연결해야 한다는 오류가 발생합니다.
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
OctopusBbsApplication.java
package octopus;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
// @SpringBootApplication
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class OctopusBbsApplication {
public static void main(String[] args) {
SpringApplication.run(OctopusBbsApplication.class, args);
}
}
아래의 설정을 추가하면, 일단 오류는 넘길 수 있습니다.
DB는 연결해야 합니다.
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
https://hermeslog.tistory.com/612
728x90