Skip to main content

One post tagged with "이슈"

View All Tags

· 3 min read

증상

hadoop-clinet resourceConfig error log

java spring boot과 hadoop에 연동하는 기능을 구현을 하는데

hadoop-client를 사용하여 개발을 정상적으로 완료하고

서버에 배포하여 실행시키는 과정에서 해당 에러가 발생

...
org.apache.catalina.core.ContainerBase.startInternal A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:873)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:794)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:248)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:921)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:186)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
... 21 more
Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/api/core/ResourceConfig
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
....

사용한 hadoop-client

implementation group: 'org.apache.hadoop', name: 'hadoop-client', version: '3.3.6'

개발하는 과정에서는 에러 로그를 발견하지를 못했습니다 (개발환경은 intellij, spring boot 내장 톰캣)

서버에 배포하고 실행을 시키면 에러가 발생하며 톰캣 서비스 자체가 뜨지 않고 종료가 됐습니다 (서버환경은 tomcat 9, war 빌드)

원인

Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/api/core/ResourceConfig
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)

톰캣의 로그가 쌓이는 곳에서(logs/catalina.out) 에러 로그를 보니

com/sun/jersey/api/core/ResourceConfig 클래스를 찾지 못해서 발생하는걸로 파악했습니다.

해결

implementation 'com.sun.jersey:jersey-bundle:1.19.4'

jersey-bundle 라이브러리를 추가하여 해결하였습니다.

의문 & 피드백

개발할때는 정상적으로 동작을 했는데 톰캣에 war로 배포를 했을때는 안되는 이유가 무엇일까?

에러 로그에서 Caused by: java.lang.NoClassDefFoundError 이부분을 보지 않고

위쪽에 있는 다른 에러 로그를 보고 파악하느라 시간과 삽질을 너무 많이 들었다

에러 로그를 좀 더 꼼꼼하고 명확하게 봐야 삽질을 줄일 수 있을 것 같다.