Product/components used and version/fix level:
java-client SDK
Detailed explanation of the problem:
I get an error when running a project as soon as I invoke getInventoryApi from an instance of a Platform class.
this.platform = new PlatformImpl(
this.url,
new CumulocityCredentialsFactory()
.withTenant(this.tenant)
.withUsername(this.username)
.withPassword(this.password)
.getCredentials());
this.identityApi = platform.getIdentityApi();
this.inventoryApi = platform.getInventoryApi();
I suppose, the problem is with dependencies and versions, but I can not tell, what I do wrong. I only need cumulocity client functions, no microservice nor agent functions. The service will not run as microservice on Cumulocity. It will just use cumulocity as a data source.
My pom.xml has following dependencies (I already had to add javax.ws.rs-API, as it was not added automatically):
<properties>
<java.version>17</java.version>
<c8y.version>1017.0.346</c8y.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.nsn.cumulocity.clients-java</groupId>
<artifactId>java-client</artifactId>
<version>${c8y.version}</version>
</dependency>
<dependency>
<groupId>com.nsn.cumulocity.clients-java</groupId>
<artifactId>java-client-model</artifactId>
<version>${c8y.version}</version>
</dependency>
</dependencies>
Error messages / full error message screenshot / log file:
APPLICATION FAILED TO START
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.cumulocity.sdk.client.CumulocityHttpClient.<init>(CumulocityHttpClient.java:26)
The following method did not exist:
'void org.glassfish.jersey.client.JerseyClient.<init>(javax.ws.rs.core.Configuration, org.glassfish.jersey.internal.util.collection.UnsafeValue, javax.net.ssl.HostnameVerifier)'
The calling method’s class, com.cumulocity.sdk.client.CumulocityHttpClient, was loaded from the following location:
jar:file:/Users/petergaspar/.m2/repository/com/nsn/cumulocity/clients-java/java-client/1017.0.346/java-client-1017.0.346.jar!/com/cumulocity/sdk/client/CumulocityHttpClient.class
The called method’s class, org.glassfish.jersey.client.JerseyClient, is available from the following locations:
jar:file:/Users/petergaspar/.m2/repository/org/glassfish/jersey/core/jersey-client/3.1.3/jersey-client-3.1.3.jar!/org/glassfish/jersey/client/JerseyClient.class
The called method’s class hierarchy was loaded from the following locations:
org.glassfish.jersey.client.JerseyClient: file:/Users/petergaspar/.m2/repository/org/glassfish/jersey/core/jersey-client/3.1.3/jersey-client-3.1.3.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes com.cumulocity.sdk.client.CumulocityHttpClient and org.glassfish.jersey.client.JerseyClient