인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

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

dl_audgh님의 프로필 이미지
dl_audgh

작성한 질문수

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

엔티티 클래스 개발 2에서 에러가 나고, h2 데이터베이스가 업데이트가 되지 않아요 ㅠㅠ

작성

·

591

0

Error creating bean with name 'entityManagerFactory' defined in class path resource 

이 에러가 나면 h2데이터 베이스를 실행하면 된다고 하셨는데 저는 실행해도 에러가 그대로 나고 있습니다 ㅜㅜ

진도를 나가고 싶은데 혼자 찾아보다가 막혔습니다..

h2 데이터베이스를 실행하면 초기에 진행했던 member 테이블만 존재합니다.

org.springframework.beans.factory.BeanCreationException: 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 org.hibernate.AnnotationException: Attribute [jpabook.jpashop.domain.Delivery.status] was annotated as enumerated, but its java type is not an enum [jpabook.jpashop.domain.DeliveryStatus]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1106) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE]

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

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

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

at jpabook.jpashop.JpashopApplication.main(JpashopApplication.java:10) ~[main/:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]

at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.17.RELEASE.jar:2.1.17.RELEASE]

Caused by: org.hibernate.AnnotationException: Attribute [jpabook.jpashop.domain.Delivery.status] was annotated as enumerated, but its java type is not an enum [jpabook.jpashop.domain.DeliveryStatus]

at org.hibernate.cfg.annotations.SimpleValueBinder.setType(SimpleValueBinder.java:267) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.cfg.annotations.PropertyBinder.makePropertyAndValue(PropertyBinder.java:185) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.cfg.annotations.PropertyBinder.makePropertyValueAndBind(PropertyBinder.java:205) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2244) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:969) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:250) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:231) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:274) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1215) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1246) ~[hibernate-core-5.3.18.Final.jar:5.3.18.Final]

at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391) ~[spring-orm-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378) ~[spring-orm-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1828) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]

... 21 common frames omitted

답변 3

1

dl_audgh님의 프로필 이미지
dl_audgh
질문자

앗 제가 그걸 못 보고 지나쳤군요!! 

나머지 오류 이것저것 잡고 실행되니 기분이 좋네요 ㅎㅎ

해결 됐습니다 감사합니다!!!

0

김영한님의 프로필 이미지
김영한
지식공유자

축하합니다^^! 이렇게 문제를 해결해가는 과정속에서 더 많은 것을 배우셨을거에요.

화이팅!

0

김영한님의 프로필 이미지
김영한
지식공유자

안녕하세요. dl_audgh님^^

오류 메시지를 잘 적어 보내주셨어요.

보내주신 오류메시지에 보면 다음과 같이 적혀있습니다.

[jpabook.jpashop.domain.Delivery.status] was annotated as enumerated, but its java type is not an enum [jpabook.jpashop.domain.DeliveryStatus]

DeliveryStatus를 enum으로 만들어야 하는데 Java로 만들어서 발생한 오류입니다.

public class DeliveryStatus -> public enum DeliveryStatus 로 변경해주세요^^

dl_audgh님의 프로필 이미지
dl_audgh

작성한 질문수

질문하기