Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Access to Cloudera Manager API fails from Spring Boot web app

Highlighted

Access to Cloudera Manager API fails from Spring Boot web app

I'm building a web app using Spring Boot. The purpose is to present in a web UI the configuration differences between 2 CDH clusters (for each service, roles, ...., till property level ).

 

The Java code of my Maven project for doing the comparison staff works fine out of Spring Boot, so in  a normal Java app. When starting to add dependencies for Spring Boot it automatically fails with:

 

 

Exception in thread "main" com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: javax/ws/rs/NotFoundException
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2261)
	at com.google.common.cache.LocalCache.get(LocalCache.java:4000)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4004)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4874)
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4880)
	at com.cloudera.api.ClouderaManagerClientBuilder.build(ClouderaManagerClientBuilder.java:259)
	at com.cloudera.api.ClouderaManagerClientBuilder.build(ClouderaManagerClientBuilder.java:245)
	at com.xxx.yyy.bigdata.cm.cmConfigMngr.ClouderaManagerConfigManagement.main(ClouderaManagerConfigManagement.java:27)
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/NotFoundException
	at com.cloudera.api.ClouderaManagerClientBuilder$1.load(ClouderaManagerClientBuilder.java:100)
	at com.cloudera.api.ClouderaManagerClientBuilder$1.load(ClouderaManagerClientBuilder.java:97)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3599)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2379)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2342)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2257)
	... 7 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.NotFoundException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 13 more

 

 

This is the pom.xml of my Java app (without Spring):

 

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.xxx.yyy.bigdata.cm</groupId>
	<artifactId>cmConfigMngr</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>cmConfigMngr</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>

		<dependency>
			<groupId>com.cloudera.api</groupId>
			<artifactId>cloudera-manager-api</artifactId>
			<version>5.8.0</version>
		</dependency>

	</dependencies>

	<repositories>
		<repository>
			<id>cdh.repo</id>
			<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
			<name>Cloudera Repository</name>
		</repository>
	</repositories>

</project>

 

This is my pom.xml with the Spring Boot added:

 

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.xxx.yyy.bigdata.cm</groupId>
	<artifactId>cmConfigMngr</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>cmConfigMngr</name>
	<url>http://maven.apache.org</url>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.0.RELEASE</version>
	</parent>


	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>

		<dependency>
			<groupId>com.cloudera.api</groupId>
			<artifactId>cloudera-manager-api</artifactId>
			<version>5.8.0</version>
		</dependency>

	</dependencies>

	<repositories>
		<repository>
			<id>cdh.repo</id>
			<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
			<name>Cloudera Repository</name>
		</repository>
	</repositories>

</project>

 

 

Simply, by adding:

 

 

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.0.RELEASE</version>
	</parent>

 

to the pom.xml the execution fails.

 

The snippet code fail on the call to the "build()" method:

 

 

		RootResourceV11 kk = new ClouderaManagerClientBuilder()
		.withHost(CM_A_HOST)
		.withPort(Integer.parseInt(CM_A_PORT))
		.withUsernamePassword(CM_A_USER, CM_A_PASS)
		.build()
		.getRootV11();

 

Does any one has any idea how to resolve this issue?

My some reason that I'm not able to understand, it seems that there is some conflict between some dependency.

 

I'm tried with <dependencyManagement>, <exclusions>, ...., changing order of dependencies, removing, adding, but I'm not able :(

 

Any idea?

 

Thanks.