Support Questions

Find answers, ask questions, and share your expertise

Ranger UI is not accessible with Context initialization failed java.lang.NoClassDefFoundError:

avatar
Contributor

I'm using hdp 25. and have installed ranger. All the services are running but ranger web service is failing. In the logs i could see below exception. Not sure on what is the issue. I have not enable ssl or kerberos on the cluster but have to enable then eventually.

2017-05-12 16:41:44,438 [host1.hdp.com-startStop-1] DEBUG org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback (JniBasedUnixGroupsMappingWithFallback.java:45) - Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping 2017-05-12 16:41:44,486 [host1.hdp.com-startStop-1] ERROR org.springframework.web.context.ContextLoader (ContextLoader.java:312) - Context initialization failed java.lang.NoClassDefFoundError: com/google/common/base/Preconditions at org.apache.hadoop.conf.Configuration$DeprecationDelta.<init>(Configuration.java:334) at org.apache.hadoop.conf.Configuration$DeprecationDelta.<init>(Configuration.java:347) at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:429) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:2153) at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:94) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:78) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136) at org.apache.hadoop.security.Groups.<init>(Groups.java:99) at org.apache.hadoop.security.Groups.<init>(Groups.java:95) at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:420) at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:297) at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:274) at org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:804) at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:774) at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:647) at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2920) at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2910) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2776) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:386) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295) at org.apache.hadoop.security.alias.JavaKeyStoreProvider.initFileSystem(JavaKeyStoreProvider.java:89) at org.apache.hadoop.security.alias.AbstractJavaKeyStoreProvider.<init>(AbstractJavaKeyStoreProvider.java:82) at org.apache.hadoop.security.alias.JavaKeyStoreProvider.<init>(JavaKeyStoreProvider.java:49) at org.apache.hadoop.security.alias.JavaKeyStoreProvider.<init>(JavaKeyStoreProvider.java:41) at org.apache.hadoop.security.alias.JavaKeyStoreProvider$Factory.createProvider(JavaKeyStoreProvider.java:100) at org.apache.hadoop.security.alias.CredentialProviderFactory.getProviders(CredentialProviderFactory.java:58) at org.apache.ranger.credentialapi.CredentialReader.getDecryptedString(CredentialReader.java:59) at org.apache.ranger.common.PropertiesUtil.processProperties(PropertiesUtil.java:83) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:662) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Preconditions at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 46 more 2017-05-12 16:41:46,075 [host1.hdp.com-startStop-1] WARN org.springframework.context.support.AbstractApplicationContext (AbstractApplicationContext.java:1040) - Exception thrown from ApplicationListener handling ContextClosedEvent java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri May 12 16:41:39 IST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:340) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:327) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1037) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1000) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:548) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2017-05-12 16:41:46,076 [host1.hdp.com-startStop-1] WARN org.springframework.context.support.AbstractApplicationContext (AbstractApplicationContext.java:1048) - Exception thrown from LifecycleProcessor on context close java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri May 12 16:41:39 IST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:353) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1045) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1000) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:548) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

1 ACCEPTED SOLUTION

avatar
Contributor

this worked after removing javax.servlet-api-3.1.0.jar tomcat-el-api-7.0.68.jar servlet-api-2.5.jar and ranger-plugins-audit-0.6.0.2.5.3.0-37.jar from /usr/hdp/2.5.3.0-37/ranger-admin/ews/lib/

View solution in original post

4 REPLIES 4

avatar

Can you verify if commons-io-2.4.jar is in classpath?

If that jar is in classpath and this error persists, see copying that jar to /usr/hdp/<version>/ranger-admin/ews/lib/ resolves the issue.

avatar
Contributor

hi @vperiasamy i have added the jar to mentioned path but i still have the issue.

avatar
Contributor

I just added all jars to above path and noe i have below exception.

WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files. May 15, 2017 10:32:57 AM org.apache.ranger.server.tomcat.EmbeddedServer start INFO: Deriving webapp folder from catalina.base property. folder=/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp May 15, 2017 10:32:57 AM org.apache.ranger.server.tomcat.EmbeddedServer start INFO: Webapp file =/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp, webAppName = / May 15, 2017 10:32:57 AM org.apache.ranger.server.tomcat.EmbeddedServer start INFO: Adding webapp [/] = path [/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp] ..... 17/05/15 10:32:57 WARN core.StandardContext: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to [] May 15, 2017 10:32:57 AM org.apache.ranger.server.tomcat.EmbeddedServer start INFO: Finished init of webapp [/] = path [/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp]. 17/05/15 10:32:57 INFO http11.Http11Protocol: Initializing ProtocolHandler ["http-bio-6080"] 17/05/15 10:32:57 INFO core.StandardService: Starting service Tomcat 17/05/15 10:32:57 INFO core.StandardEngine: Starting Servlet Engine: Apache Tomcat/7.0.68 17/05/15 10:32:57 INFO loader.WebappClassLoaderBase: validateJarFile(/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp/WEB-INF/lib/javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class 17/05/15 10:32:57 INFO loader.WebappClassLoaderBase: validateJarFile(/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class 17/05/15 10:32:57 INFO loader.WebappClassLoaderBase: validateJarFile(/usr/hdp/2.5.3.0-37/ranger-admin/ews/webapp/WEB-INF/lib/tomcat-el-api-7.0.68.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class 17/05/15 10:32:57 INFO startup.ContextConfig: No global web.xml found 17/05/15 10:32:57 ERROR core.ContainerBase: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[host1.hdp.com].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[host1.hdp.com].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) ... 6 more Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:95) at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1575) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1281) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more 17/05/15 10:32:57 ERROR core.ContainerBase: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[host1.hdp.com]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at

avatar
Contributor

this worked after removing javax.servlet-api-3.1.0.jar tomcat-el-api-7.0.68.jar servlet-api-2.5.jar and ranger-plugins-audit-0.6.0.2.5.3.0-37.jar from /usr/hdp/2.5.3.0-37/ranger-admin/ews/lib/