728x90
회사 프로젝트에서 가끔 전날에는 없던 에러가 발생할 때가 있었다..ㅠㅠ아침부터 스트레스를 받고 이건 뭔가 하던 오류 중에 하나로
[09:20:58.247] [ERROR] org.springframework.web.context.ContextLoader [initWebApplicationContext:350] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1630)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at com.douzone.gpd.web.context.support.DzWebApplicationContext.refresh(DzWebApplicationContext.java:48)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at com.douzone.gpd.web.context.DzWebAppServletContextListener.initWebApplicationContext(DzWebAppServletContextListener.java:36)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at com.douzone.gpd.web.context.DzWebAppServletContextListener.contextInitialized(DzWebAppServletContextListener.java:24)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.hibernate.validator.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:252)
at org.hibernate.validator.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:143)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:310)
at org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean.afterPropertiesSet(OptionalValidatorFactoryBean.java:40)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626)
... 24 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 30 common frames omitted
5월 14, 2021 9:20:58 오전 org.apache.catalina.core.StandardContext listenerStart
이런 장문의 편지와 함께 머리가 어지러웠다..
오류의 내용으로는
Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0'
라는 것이었고, maven에 validation-api 설정 시 오류가 발생하는 것이라고 한다.
그래서 가장 중요한 해결방법은
pom.xml에 dependency를 추가 해주면 된다!!
저같이 멀티 프로젝트일 경우 참조되는 web app 프로젝트들은 놔두고 메인(?) 프로젝트의 pom.xml에만 추가해주시면 됩니다.
추가할 내용은
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>5.2.4.Final</version>
</dependency>
다른 글에서 살펴보니
<version>4.1.0.Final </version>로 되어있을 경우는 해결이 안 될 때가 있었다고 하니 참고해주시면 좋을 것 같습니다!
728x90
'Programming > Java' 카테고리의 다른 글
[JAVA]OOP란? - 상속이란? (0) | 2021.05.21 |
---|---|
[JAVA] OOP - 클래스&인스턴스란? (0) | 2021.05.21 |
[MQTT] window & linux mosquitto 설치 방법 (0) | 2021.01.29 |
[MQTT] MQTT broker 종류 (0) | 2021.01.29 |
[Javascript Framework] Property (0) | 2020.12.28 |
댓글