인프런 커뮤니티 질문&답변

모수혁님의 프로필 이미지
모수혁

작성한 질문수

스프링 부트 개념과 활용

스프링 데이터 2부: 인메모리 데이터베이스

에러 질문입니다.

작성

·

3.1K

0

진행중인 프로젝트의 깃 주소는

https://github.com/Mosuhyeok/springError

이것입니다

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2020-05-01 17:13:21.571 ERROR 12500 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute ApplicationRunner

이 에러가 왜 뜨는지 잘 모르겠습니다..

H2runner 파일을 다 주석처리하고 실행하면 잘 되는데

주석을 해제하면 오류가 납니다..

그리고 제가 여러 블로그들을 참고하며 crud 게시판을 구현 해보려고 하는 중인데

매번 데이터베이스 설정에서

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

이 에러가 자주 뜨는데 왜 그런걸까요...?

--전체 에러코드--

2020-05-01 17:28:49.482  INFO 7576 --- [           main] d.d.DemodlkfksdkfApplication             : Starting DemodlkfksdkfApplication on DESKTOP-TLQC95G with PID 7576 (C:\Users\MoMoRing\Spring-Folder\demodlkfksdkf\target\classes started by MoMoRing in C:\Users\MoMoRing\Spring-Folder\demodlkfksdkf)

2020-05-01 17:28:49.484  INFO 7576 --- [           main] d.d.DemodlkfksdkfApplication             : No active profile set, falling back to default profiles: default

2020-05-01 17:28:50.034  INFO 7576 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.

2020-05-01 17:28:50.048  INFO 7576 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11ms. Found 0 JDBC repository interfaces.

2020-05-01 17:28:50.433  INFO 7576 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)

2020-05-01 17:28:50.439  INFO 7576 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2020-05-01 17:28:50.440  INFO 7576 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.33]

2020-05-01 17:28:50.510  INFO 7576 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

2020-05-01 17:28:50.510  INFO 7576 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 985 ms

2020-05-01 17:28:50.535  INFO 7576 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2020-05-01 17:28:50.613  INFO 7576 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2020-05-01 17:28:50.617  INFO 7576 --- [           main] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:testdb'

2020-05-01 17:28:50.781  INFO 7576 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'

2020-05-01 17:28:50.956  INFO 7576 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''

2020-05-01 17:28:50.958  INFO 7576 --- [           main] d.d.DemodlkfksdkfApplication             : Started DemodlkfksdkfApplication in 1.715 seconds (JVM running for 2.21)

jdbc:h2:mem:testdb

SA

2020-05-01 17:28:50.964  INFO 7576 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2020-05-01 17:28:50.970 ERROR 7576 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute ApplicationRunner

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:778) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

at d.demodlkfksdkf.DemodlkfksdkfApplication.main(DemodlkfksdkfApplication.java:10) ~[classes/:na]

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "CREATE TABLE USER (ID INTEGER NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))

INSERT[*] INTO USER VALUES (1, ‘KEESUN’)"; SQL statement:

CREATE TABLE USER (ID INTEGER NOT NULL, name VARCHAR(255), PRIMARY KEY (id))

INSERT INTO USER VALUES (1, ‘keesun’) [42000-200]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:453) ~[h2-1.4.200.jar:1.4.200]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) ~[h2-1.4.200.jar:1.4.200]

at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.200.jar:1.4.200]

at org.h2.message.DbException.get(DbException.java:181) ~[h2-1.4.200.jar:1.4.200]

at org.h2.message.DbException.getSyntaxError(DbException.java:229) ~[h2-1.4.200.jar:1.4.200]

at org.h2.command.Parser.getSyntaxError(Parser.java:1051) ~[h2-1.4.200.jar:1.4.200]

at org.h2.command.Parser.prepareCommand(Parser.java:741) ~[h2-1.4.200.jar:1.4.200]

at org.h2.engine.Session.prepareLocal(Session.java:657) ~[h2-1.4.200.jar:1.4.200]

at org.h2.engine.Session.prepareCommand(Session.java:595) ~[h2-1.4.200.jar:1.4.200]

at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1235) ~[h2-1.4.200.jar:1.4.200]

at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:164) ~[h2-1.4.200.jar:1.4.200]

at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:126) ~[h2-1.4.200.jar:1.4.200]

at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:120) ~[HikariCP-3.4.2.jar:na]

at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java) ~[HikariCP-3.4.2.jar:na]

at d.demodlkfksdkf.H2Runner.run(H2Runner.java:23) ~[classes/:na]

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:775) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]

... 5 common frames omitted

2020-05-01 17:28:50.973  INFO 7576 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

2020-05-01 17:28:50.974  INFO 7576 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2020-05-01 17:28:50.977  INFO 7576 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Process finished with exit code 1

답변 3

0

복붙해서 쓰셔서 따옴표 표시가 잘못 들어가서 그런듯 하네요 표시를 '표시로 바꿔서 사용해 보세요 

0

모수혁님의 프로필 이미지
모수혁
질문자

아하.... 답변 감사합니다

0

백기선님의 프로필 이미지
백기선
지식공유자

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "CREATE TABLE USER (ID INTEGER NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))

INSERT[*] INTO USER VALUES (1, ‘KEESUN’)"; SQL statement:

CREATE TABLE USER (ID INTEGER NOT NULL, name VARCHAR(255), PRIMARY KEY (id))

INSERT INTO USER VALUES (1, ‘keesun’) [42000-200]

에러 원인을 모르시는거 같은데.. 이 부분이 핵심입니다.

모수혁님의 프로필 이미지
모수혁

작성한 질문수

질문하기