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

kcm9561님의 프로필 이미지
kcm9561

작성한 질문수

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

entity를 다만들고 실행을 해보는데 자꾸 에러가 나오는데 해결을 못하겠습니다.

해결된 질문

작성

·

274

·

수정됨

1

jpa활용 강의를 듣던중에 entity를 다 만들고 실행을 해보는데 에러가 나오긴하는데 어떤게 문제인지 정확히 잘 모르겠습니다.. 실행하면 실행되다가 에러메시지가 나오면서 바로 종료되버리는데 뭐가 문제인지 모르겠습니다ㅠㅠ

그리고 구글 드라이브 업로드로 파일을 올리려고 했는데 자꾸 gradle. 경로를 찾을 수 없다고 압축이 안됩니다.. 그래서 일단 메시지로 올려봅니다.

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

2024-01-07T20:07:18.943+09:00 ERROR 1872 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Property 'jpabook.jpashop.domain.Delivery.status' is annotated '@Enumerated' but its type 'jpabook.jpashop.domain.DeliveryStatus' is not an enum

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775) ~[spring-beans-6.1.1.jar:6.1.1]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.1.1.jar:6.1.1]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar:6.1.1]

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

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

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar:6.1.1]

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

at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1173) ~[spring-context-6.1.1.jar:6.1.1]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:936) ~[spring-context-6.1.1.jar:6.1.1]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar:6.1.1]

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

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar:3.2.0]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar:3.2.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar:3.2.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]

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

Caused by: org.hibernate.AnnotationException: Property 'jpabook.jpashop.domain.Delivery.status' is annotated '@Enumerated' but its type 'jpabook.jpashop.domain.DeliveryStatus' is not an enum

at org.hibernate.boot.model.internal.BasicValueBinder.prepareBasicAttribute(BasicValueBinder.java:805) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.BasicValueBinder.setType(BasicValueBinder.java:374) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.makePropertyAndValue(PropertyBinder.java:261) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.makePropertyValueAndBind(PropertyBinder.java:297) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.createBasicBinder(PropertyBinder.java:1169) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.bindBasic(PropertyBinder.java:1071) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.bindProperty(PropertyBinder.java:890) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.buildProperty(PropertyBinder.java:788) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.PropertyBinder.processElementAnnotations(PropertyBinder.java:709) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.EntityBinder.processIdPropertiesIfNotAlready(EntityBinder.java:977) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.EntityBinder.handleIdentifier(EntityBinder.java:305) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.EntityBinder.bindEntityClass(EntityBinder.java:231) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

at org.hibernate.boot.model.internal.AnnotationBinder.bindClass(AnnotationBinder.java:422) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

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

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

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

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

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

at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.1.jar:6.1.1]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.1.1.jar:6.1.1]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.1.jar:6.1.1]

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.1.jar:6.1.1]

at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.1.jar:6.1.1]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822) ~[spring-beans-6.1.1.jar:6.1.1]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771) ~[spring-beans-6.1.1.jar:6.1.1]

... 16 common frames omitted

Process finished with exit code 1

답변 1

0

안녕하세요. kcm9561님, 공식 서포터즈 OMG입니다.

압축이 안되는 이유는 잘 모르겠으나 예상되는 바는 프로젝트로 해당 JPA프로젝트를 실행중이여서 그런 것이지 않나 싶습니다.(정확하진 않습니다.)

그리고 오류 발생 원인의 경우 오류 메시지에도 포함되어 있지만 DeliveryStatus클래스 파일을 생성할 때 enum이 아닌 class로 되어 있어서 발생하는 것 같네요 ^^

enum으로 수정해주세요 😀

image

해결이 안될 경우 댓글남겨주세요

감사합니다.

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

아..정말 감사합니다 ㅠㅠ

class로 하던게 습관이 되어있어서 OrderStatus랑 DeliveryStatus 둘 다 class로 되어있었네요. 테이블 정상적으로 생성됐습니다.

kcm9561님의 프로필 이미지
kcm9561

작성한 질문수

질문하기