SAP / cloud-sdk-java

Use the SAP Cloud SDK for Java to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
22 stars 13 forks source link

Test function results in NoClassDefFoundError #89

Closed ToolsPool closed 1 year ago

ToolsPool commented 1 year ago

Hi

I'm currently working on creating some tests using the Java Cloud SDK.

My code is as follows:

Source function:

public List<OutboundDeliveryHeaders> getTop5Deliveries() {
    List<OutboundDeliveryHeaders> deliveries = new ArrayList<>();

    try {
        deliveries = outboundDeliveryService.getAllOutbDeliveryHeader()
                .top(5)
                .executeRequest(httpDest);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return deliveries;
}

Test code:

@SpringBootTest
@ActiveProfiles("dev")
@TestPropertySource(locations = "classpath:application-dev.properties")
public class Sap4HanaServiceTest {

    @Autowired
    Sap4HanaService sapInterface;

    @Test
    void test1() {
            sapInterface.getTop5Deliveries();
    }
}

The function works well when run the program locally under normal conditions. However, when I attempt to execute the test function, I encounter the following error message:

Error Message

 at com.sap.cloud.sdk.cloudplatform.tenant.ScpCfTenantFacade.tryGetCurrentTenant(ScpCfTenantFacade.java:148)
 at io.vavr.control.Try.flatMapTry(Try.java:490)
 at io.vavr.control.Try.flatMap(Try.java:472)
 at com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor.tryGetCurrentTenant(TenantAccessor.java:133)
 at com.sap.cloud.sdk.cloudplatform.cache.CacheKey.ofTenantOptionalIsolation(CacheKey.java:169)
 at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpClientCache.lambda$getCacheKey$c78dc2e0$1(DefaultHttpClientCache.java:83)
 at io.vavr.control.Try.of(Try.java:75)
 at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpClientCache.getCacheKey(DefaultHttpClientCache.java:79)
 at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetOrCreateHttpClient(AbstractHttpClientCache.java:80)
 at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetHttpClient(AbstractHttpClientCache.java:46)
 at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.tryGetHttpClient(HttpClientAccessor.java:171)
 at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient(HttpClientAccessor.java:149)
 at com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperRead.executeInternal(FluentHelperRead.java:210)
 at com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperRead.executeRequest(FluentHelperRead.java:160)
 at com.gilgendoorsystems.varwebsolution.api.service.sap.Sap4HanaService.getCustomerOrders(Sap4HanaService.java:124)
 at com.gilgendoorsystems.varwebsolution.api.service.sap.Sap4HanaServiceTest.testGetCustomerOrders(Sap4HanaServiceTest.java:82)
 at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
 at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Caused by: java.lang.ExceptionInInitializerError: Exception java.util.ServiceConfigurationError: com.sap.cloud.sdk.cloudplatform.security.AuthTokenFacade: Provider com.sap.cloud.sdk.cloudplatform.security.ScpCfAuthTokenFacade could not be instantiated [in thread "main"]
 at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
 at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
 at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
 at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
 at com.google.common.collect.Iterators.addAll(Iterators.java:367)
 at com.google.common.collect.Lists.newArrayList(Lists.java:146)
 at com.google.common.collect.Lists.newArrayList(Lists.java:132)
 at com.sap.cloud.sdk.cloudplatform.util.FacadeLocator$MockableInstance.getFacades(FacadeLocator.java:60)
 at com.sap.cloud.sdk.cloudplatform.util.FacadeLocator.getFacades(FacadeLocator.java:153)
 at com.sap.cloud.sdk.cloudplatform.security.AuthTokenAccessor.getDefaultAuthTokenFacade(AuthTokenAccessor.java:77)
 at com.sap.cloud.sdk.cloudplatform.security.AuthTokenAccessor.(AuthTokenAccessor.java:48)
 at com.sap.cloud.sdk.cloudplatform.tenant.ScpCfTenantFacade.tryGetCurrentTenant(ScpCfTenantFacade.java:148)
 at io.vavr.control.Try.flatMapTry(Try.java:490)
 at io.vavr.control.Try.flatMap(Try.java:472)
 at com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor.tryGetCurrentTenant(TenantAccessor.java:133)
 at com.sap.cloud.sdk.cloudplatform.cache.CacheKey.ofTenantOptionalIsolation(CacheKey.java:169)
 at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpClientCache.lambda$getCacheKey$c78dc2e0$1(DefaultHttpClientCache.java:83)
 at io.vavr.control.Try.of(Try.java:75)
 at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpClientCache.getCacheKey(DefaultHttpClientCache.java:79)
 at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetOrCreateHttpClient(AbstractHttpClientCache.java:80)
 at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetHttpClient(AbstractHttpClientCache.java:46)
 at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.tryGetHttpClient(HttpClientAccessor.java:171)
 at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient(HttpClientAccessor.java:149)
 at com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperRead.executeInternal(FluentHelperRead.java:210)
 at com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperRead.executeRequest(FluentHelperRead.java:160)
 at com.gilgendoorsystems.varwebsolution.api.service.sap.Sap4HanaService.getCustomerOrders(Sap4HanaService.java:124)
 at com.gilgendoorsystems.varwebsolution.api.service.sap.Sap4HanaServiceTest.testGetCustomerOrders(Sap4HanaServiceTest.java:76)
 ... 70 more

Maven Dependency Tree
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:3.1.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:3.1.4:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:3.1.4:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:3.1.4:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:3.1.4:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.4.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.4.11:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.20.0:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:2.0.9:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.33:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:3.1.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.2:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.2:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.2:compile
[INFO] |  +- org.springframework:spring-web:jar:6.0.12:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:6.0.12:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:3.1.4:compile
[INFO] |  +- org.springframework:spring-aop:jar:6.0.12:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:6.1.4:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:6.1.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:3.1.4:compile
[INFO] |  +- org.springframework:spring-context-support:jar:6.0.12:compile
[INFO] |  \- org.eclipse.angus:jakarta.mail:jar:1.1.0:compile
[INFO] |     +- jakarta.activation:jakarta.activation-api:jar:2.1.2:compile
[INFO] |     \- org.eclipse.angus:angus-activation:jar:2.0.1:runtime
[INFO] +- org.springframework.ldap:spring-ldap-core:jar:3.1.1:compile
[INFO] |  +- org.springframework:spring-core:jar:6.0.12:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:6.0.12:compile
[INFO] |  +- org.springframework:spring-beans:jar:6.0.12:compile
[INFO] |  +- org.springframework:spring-tx:jar:6.0.12:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:2.0.9:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.1.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:3.1.4:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.20:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:3.1.4:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:5.0.1:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:6.0.12:compile
[INFO] |  +- org.hibernate.orm:hibernate-core:jar:6.2.9.Final:compile
[INFO] |  |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
[INFO] |  |  +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.5.3.Final:runtime
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.6.Final:runtime
[INFO] |  |  +- io.smallrye:jandex:jar:3.0.5:runtime
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:runtime
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.14.8:runtime
[INFO] |  |  +- org.glassfish.jaxb:jaxb-runtime:jar:4.0.3:runtime
[INFO] |  |  |  \- org.glassfish.jaxb:jaxb-core:jar:4.0.3:runtime
[INFO] |  |  |     +- org.glassfish.jaxb:txw2:jar:4.0.3:runtime
[INFO] |  |  |     \- com.sun.istack:istack-commons-runtime:jar:4.1.2:runtime
[INFO] |  |  +- jakarta.inject:jakarta.inject-api:jar:2.0.1:runtime
[INFO] |  |  \- org.antlr:antlr4-runtime:jar:4.10.1:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:3.1.4:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:3.1.4:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:6.0.12:compile
[INFO] |  \- org.springframework:spring-aspects:jar:6.0.12:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:3.1.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:3.1.4:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:3.1.4:compile
[INFO] |  +- io.micrometer:micrometer-observation:jar:1.11.4:compile
[INFO] |  |  \- io.micrometer:micrometer-commons:jar:1.11.4:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.11.4:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:runtime
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.1.4:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:3.1.4:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.1.4:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.8.0:test
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:runtime
[INFO] |  +- net.minidev:json-smart:jar:2.4.11:test
[INFO] |  |  \- net.minidev:accessors-smart:jar:2.4.11:test
[INFO] |  |     \- org.ow2.asm:asm:jar:9.3:test
[INFO] |  +- org.assertj:assertj-core:jar:3.24.2:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.9.3:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.9.3:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.9.3:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.9.3:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.3:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.9.3:test
[INFO] |  +- org.mockito:mockito-core:jar:5.3.1:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.14.8:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.3:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:5.3.1:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:6.0.12:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] +- org.springframework.security:spring-security-test:jar:6.1.4:test
[INFO] |  \- org.springframework.security:spring-security-core:jar:6.1.4:compile
[INFO] |     \- org.springframework.security:spring-security-crypto:jar:6.1.4:compile
[INFO] +- org.apache.tomcat.embed:tomcat-embed-jasper:jar:10.1.13:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.13:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-annotations-api:jar:10.1.13:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.13:compile
[INFO] |  \- org.eclipse.jdt:ecj:jar:3.33.0:compile
[INFO] +- jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:jar:3.0.0:compile
[INFO] |  +- jakarta.servlet:jakarta.servlet-api:jar:6.0.0:compile
[INFO] |  \- jakarta.el:jakarta.el-api:jar:5.0.0:compile
[INFO] +- org.glassfish.web:jakarta.servlet.jsp.jstl:jar:3.0.1:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:6.1.4:compile
[INFO] |  +- org.springframework.security:spring-security-acl:jar:6.1.4:compile
[INFO] |  +- org.springframework:spring-context:jar:6.0.12:compile
[INFO] |  \- org.springframework:spring-expression:jar:6.0.12:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.1.4:provided
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.13:provided
[INFO] +- com.microsoft.sqlserver:mssql-jdbc:jar:12.4.0.jre11:compile
[INFO] +- org.commonmark:commonmark:jar:0.21.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.13.0:compile
[INFO] +- org.apache.commons:commons-text:jar:1.10.0:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:5.2.3:compile
[INFO] |  +- org.apache.poi:poi:jar:5.2.3:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  |  +- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] |  |  \- com.zaxxer:SparseBitSet:jar:1.2:compile
[INFO] |  +- org.apache.poi:poi-ooxml-lite:jar:5.2.3:compile
[INFO] |  +- org.apache.xmlbeans:xmlbeans:jar:5.1.1:compile
[INFO] |  +- org.apache.commons:commons-compress:jar:1.21:compile
[INFO] |  +- com.github.virtuald:curvesapi:jar:1.07:compile
[INFO] |  +- org.apache.logging.log4j:log4j-api:jar:2.20.0:compile
[INFO] |  \- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] +- commons-io:commons-io:jar:2.13.0:compile
[INFO] +- commons-net:commons-net:jar:3.9.0:compile
[INFO] +- me.saro:sap-jco-manager:jar:3.0.14.7:compile
[INFO] +- me.saro:kit:jar:0.0.7:compile
[INFO] +- com.sap.conn.jco:sapjco3:jar:3.0.14:system
[INFO] +- com.sap.cloud.sdk:sdk-bom:pom:4.24.0:import
[INFO] +- com.sap.cloud.sdk.cloudplatform:scp-cf:jar:4.24.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:auditlog-scp-cf:jar:4.24.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.cloudplatform:auditlog:jar:4.24.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:caching:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:security:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:tenant:jar:4.24.0:compile
[INFO] |  |  \- com.github.ben-manes.caffeine:caffeine:jar:3.1.8:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core-scp-cf:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding.api:java-access-api:jar:0.10.0:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding:java-sap-vcap-services:jar:0.10.0:compile
[INFO] |  |  |  \- org.json:json:jar:20230618:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding.api:java-consumption-api:jar:0.10.0:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding.api:java-core-api:jar:0.10.0:compile
[INFO] |  |  +- com.mikesamuel:json-sanitizer:jar:1.2.3:compile
[INFO] |  |  \- com.auth0:java-jwt:jar:4.4.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp-cf:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:connectivity-oauth:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:resilience:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.frameworks:resilience4j:jar:4.24.0:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-circuitbreaker:jar:1.7.1:runtime
[INFO] |  |  |  |  \- io.github.resilience4j:resilience4j-core:jar:1.7.1:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-bulkhead:jar:1.7.1:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-timelimiter:jar:1.7.1:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-retry:jar:1.7.1:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-ratelimiter:jar:1.7.1:runtime
[INFO] |  |  |  \- javax.cache:cache-api:jar:1.1.1:runtime
[INFO] |  |  +- com.sap.cloud.security.xsuaa:token-client:jar:2.13.9:compile
[INFO] |  |  |  \- com.sap.cloud.security.xsuaa:api:jar:2.13.9:compile
[INFO] |  |  \- com.sap.cloud.security:java-api:jar:2.13.9:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:security-scp-cf:jar:4.24.0:compile
[INFO] |  |  +- com.sap.cloud.security:java-security:jar:2.13.9:compile
[INFO] |  |  \- com.sap.cloud.security:env:jar:2.13.9:compile
[INFO] |  |     \- com.sap.cloud.environment.servicebinding:java-sap-service-operator:jar:0.5.2:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:servlet:jar:4.24.0:compile
[INFO] |  \- com.sap.cloud.sdk.cloudplatform:tenant-scp-cf:jar:4.24.0:compile
[INFO] +- com.sap.cloud.sdk.datamodel:odata-core:jar:4.24.0:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:odata-client:jar:4.24.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:4.24.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:4.24.0:compile
[INFO] |  |  +- org.bouncycastle:bcprov-jdk18on:jar:1.76:compile
[INFO] |  |  \- org.bouncycastle:bcpkix-jdk18on:jar:1.76:compile
[INFO] |  |     \- org.bouncycastle:bcutil-jdk18on:jar:1.76:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:fluent-result:jar:4.24.0:compile
[INFO] |  +- org.slf4j:jcl-over-slf4j:jar:2.0.9:runtime
[INFO] |  +- com.google.guava:guava:jar:32.1.2-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:3.33.0:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.18.0:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.10.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.15.2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.15.2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.15.2:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.4:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.4:compile
[INFO] |  \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.30:provided
[INFO] \- javax.inject:javax.inject:jar:1:provided

Project Details


Checklist

Where does this error come from and how can i fix it?

MatKuhr commented 1 year ago

Hey, the issue is likely that you have the Security Library v2 (e.g. com.sap.cloud.security.xsuaa:token-client:jar:2.13.9:compile) with Spring 6 / Spring Boot 3 / Java 17 (e.g. org.springframework.boot:spring-boot-starter-web:jar:3.1.4:compile).

When using Spring 6 / Spring Boot 3 / Java 17 you need a version >= 3.0.0 of com.sap.cloud.security. You can achieve this for example by giving

<dependency>
    <groupId>com.sap.cloud.security</groupId>
    <artifactId>java-bom</artifactId>
    <version>3.1.3</version>
    <scope>import</scope>
    <type>pom</type>
</dependency>

at the top of your dependency management section.

ToolsPool commented 1 year ago

Hey

Thank you very much! This solved the issue.

On the topic of Java 17: The FAQ suggests transitioning from javax.inject to jakarta.inject-api. However, I've noticed that the OData Generator Maven Plugin continues to generate source code using the old javax module. Is there a way to modify the code generation process to use the new package?

MatKuhr commented 1 year ago

Good to hear this fixed it. We now also added this information to our docs, so thanks for raising this 👍🏻

Regarding the OData generator: We are planning to remove the generation of this annotation with the next major version of the Cloud SDK, because she annotation didn't bring much value in our experience. Version 5.0.0 is planned to be released still this quarter, but there is no specific date yet. But once it is released you can just update and re-generate and the change should take effect.

ToolsPool commented 1 year ago

I greatly appreciate your help and informations.

Perfect. So for the time being I will keep the the javax.inject dependency and as soon as the update drops i will remove it.