SAP / cloud-sdk

The SAP Cloud SDK documentation and support repository.
https://sap.github.io/cloud-sdk/
Apache License 2.0
45 stars 41 forks source link

Unable to connect to Destination service using cloud-sdk and JDK11 #1035

Closed biswaranjanray closed 2 years ago

biswaranjanray commented 2 years ago

Issue Description

We are facing issues while connecting to a destination service in our application using cloud-sdk. We're basically trying to migrate the application from JDK8 to JDK11. Here is the code snippet that's throwing the error:

Destination destination = DestinationAccessor.getDestination(DESTINATION_NAME);

Impact / Priority

Unable to migrate the app from jdk8 to jdk11. Release is impacted.

Error Message


   2022-09-29T19:13:48.41+0530 [APP/PROC/WEB/0] OUT ************************************************************
   2022-09-29T19:13:48.45+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.459  INFO 7 --- [nio-8080-exec-8] c.s.r.e.s.AbstractSalesOrderService      : applying resilience patterns before calling the tax-service
   2022-09-29T19:13:48.53+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.530  INFO 7 --- [Pool-worker-115] c.s.c.s.c.c.DestinationAccessor          : Creating a new DestinationLoaderChain with EnvVarDestinationLoader as the primary DestinationLoader implementation.
   2022-09-29T19:13:48.53+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.533  INFO 7 --- [Pool-worker-115] c.s.c.s.c.c.DestinationAccessor          : Using an instance of ScpCfDestinationLoader as the secondary DestinationLoader implementation.
   2022-09-29T19:13:48.53+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.533  INFO 7 --- [Pool-worker-115] c.s.c.s.c.c.DestinationAccessor          : Setting the current DestinationLoader used to a custom instance of DestinationLoaderChain.
   2022-09-29T19:13:48.62+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.620  INFO 7 --- [Pool-worker-115] c.s.c.s.t.v.v.JwtAudienceValidator       : configured JwtAudienceValidator with clientId sb-espm-cloud-native-uaa-11!t11427.
   2022-09-29T19:13:48.62+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.621  INFO 7 --- [Pool-worker-115] c.s.c.s.t.v.v.JwtAudienceValidator       : configured JwtAudienceValidator with clientId espm-cloud-native-uaa-11!t11427.
   2022-09-29T19:13:48.70+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.709  INFO 7 --- [dk-resilience-0] c.s.c.security.client.HttpClientFactory  : loaded HttpClientFactory service providers: []
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get destination.
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationServiceAdapter.getDestinationConfigurationAsJson(ScpCfDestinationServiceAdapter.java:270)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.getDestinationConfigurationFromDestinationService(ScpCfDestinationLoader.java:266)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.getDestinationConfigurationByTenant(ScpCfDestinationLoader.java:204)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.getDestinationConfigurationByRetrievalStrategy(ScpCfDestinationLoader.java:179)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.loadAndParseDestination(ScpCfDestinationLoader.java:138)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.lambda$null$0(ScpCfDestinationLoader.java:118)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2406)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ConcurrentHashMap.compute(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2404)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2387)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.github.benmanes.caffeine.cache.LocalManualCache.get(LocalManualCache.java:62)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.lambda$tryGetDestination$2ec57ad6$1(ScpCfDestinationLoader.java:118)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at io.vavr.control.Try.of(Try.java:75)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.tryGetDestination(ScpCfDestinationLoader.java:118)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoaderChain.tryGetDestination(DestinationLoaderChain.java:82)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoader.tryGetDestination(DestinationLoader.java:36)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.tryGetDestination(DestinationAccessor.java:143)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.getDestination(DestinationAccessor.java:121)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.service.CloudSalesOrderService.getTaxUrlFromDestinationService(CloudSalesOrderService.java:230)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.service.CloudSalesOrderService.getTaxUri(CloudSalesOrderService.java:217)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.service.CloudSalesOrderService.supplyTax(CloudSalesOrderService.java:135)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.service.AbstractSalesOrderService$$FastClassBySpringCGLIB$$75e64c37.invoke(<generated>)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:704)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.service.AbstractSalesOrderService$$EnhancerBySpringCGLIB$$a8dc74b6.supplyTax(<generated>)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.refapps.espm.util.ResilienceHandler.lambda$applyResiliencePatterns$0(ResilienceHandler.java:111)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR Caused by: com.sap.cloud.sdk.cloudplatform.resilience.ResilienceRuntimeException: com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.security.token.ProviderNotFoundException: No HttpClientFactory service could be found in the classpath
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.frameworks.resilience4j.Resilience4jDecorationStrategy.lambda$null$3(Resilience4jDecorationStrategy.java:238)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at io.vavr.control.Try.onFailure(Try.java:659)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.frameworks.resilience4j.Resilience4jDecorationStrategy.lambda$decorateCallable$4(Resilience4jDecorationStrategy.java:237)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.resilience.ResilienceDecorationStrategy.executeCallable(ResilienceDecorationStrategy.java:261)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.resilience.ResilienceDecorator.executeCallable(ResilienceDecorator.java:251)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationServiceAdapter.getDestinationConfigurationAsJson(ScpCfDestinationServiceAdapter.java:257)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR ... 35 more
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR Caused by: com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.security.token.ProviderNotFoundException: No HttpClientFactory service could be found in the classpath
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.thread.AbstractThreadContextExecutor.execute(AbstractThreadContextExecutor.java:326)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.frameworks.resilience4j.DefaultThreadContextProvider.lambda$decorateCallable$0(DefaultThreadContextProvider.java:26)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at io.github.resilience4j.bulkhead.Bulkhead.lambda$decorateCallable$4(Bulkhead.java:177)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.lang.Thread.run(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR Caused by: com.sap.cloud.security.token.ProviderNotFoundException: No HttpClientFactory service could be found in the classpath
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.security.client.HttpClientFactory.create(HttpClientFactory.java:62)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.security.OAuth2TokenServiceCache$Default.getHttpClient(OAuth2TokenServiceCache.java:111)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.security.OAuth2TokenServiceCache$Default.lambda$getTokenService$0(OAuth2TokenServiceCache.java:105)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.security.OAuth2TokenServiceCache$Default.getTokenService(OAuth2TokenServiceCache.java:105)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.security.DefaultOAuth2ServiceProvider.getXsuaaTokenFlows(DefaultOAuth2ServiceProvider.java:207)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.createTokenFlow(XsuaaService.java:143)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.retrieveAccessTokenViaClientCredentialsGrant(XsuaaService.java:68)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationServiceAdapter.getAccessTokenForDestinationService(ScpCfDestinationServiceAdapter.java:291)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationServiceAdapter.lambda$getDestinationConfigurationAsJson$0(ScpCfDestinationServiceAdapter.java:259)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.frameworks.resilience4j.Resilience4jDecorationStrategy.lambda$decorateCallable$2(Resilience4jDecorationStrategy.java:217)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextCallable.call(ThreadContextCallable.java:229)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR at com.sap.cloud.sdk.cloudplatform.thread.AbstractThreadContextExecutor.execute(AbstractThreadContextExecutor.java:320)
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] ERR ... 6 more
   2022-09-29T19:13:48.71+0530 [APP/PROC/WEB/0] OUT 2022-09-29 13:43:48.717 ERROR 7 --- [Pool-worker-115] c.s.r.e.service.CloudSalesOrderService   : Failed to get destination.

Project Details


Checklist

Johannes-Schneider commented 2 years ago

Hi @biswaranjanray,

thanks for reaching out to us. From the stacktrace, it looks like this is some sort of dependency issue. Could you please provide the output of the mvn dependency:tree command in this issue?

Best regards, Johannes

biswaranjanray commented 2 years ago

Hi Johannes,

Thanks for your response. Please find below the dependency tree o/p. Please note the destination works fine when cloud-sdk 3.74.0 is used with JDK8.

[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.sap.refapps.espm:sale-service >------------------
[INFO] Building sale-service 1.2.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ sale-service ---
[INFO] com.sap.refapps.espm:sale-service:jar:1.2.0
[INFO] +- com.sap.refapps.espm:commons:jar:1.2.0:compile
[INFO] |  +- com.sap.cloud.db.jdbc:ngdbc:jar:2.12.7:compile
[INFO] |  +- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.7.9:compile
[INFO] |  |  +- org.eclipse.persistence:jakarta.persistence:jar:2.2.3:compile
[INFO] |  |  +- org.eclipse.persistence:org.eclipse.persistence.asm:jar:9.1.0:compile
[INFO] |  |  +- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.7.9:compile
[INFO] |  |  +- org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.7.9:compile
[INFO] |  |  \- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.7.9:compile
[INFO] |  \- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.6.6:compile
[INFO] |     +- org.springframework.boot:spring-boot-starter-aop:jar:2.6.6:compile
[INFO] |     |  \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] |     +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.6.6:compile
[INFO] |     |  +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] |     |  \- org.springframework:spring-jdbc:jar:5.3.21:compile
[INFO] |     +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |     +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |     +- org.springframework.data:spring-data-jpa:jar:2.6.3:compile
[INFO] |     |  +- org.springframework.data:spring-data-commons:jar:2.6.3:compile
[INFO] |     |  \- org.springframework:spring-orm:jar:5.3.21:compile
[INFO] |     \- org.springframework:spring-aspects:jar:5.3.21:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.6.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.6.6:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.3:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.6.6:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.60:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.60:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.60:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.21:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.21:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.21:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.21:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.21:compile
[INFO] +- org.postgresql:postgresql:jar:42.2.19:compile
[INFO] |  \- org.checkerframework:checker-qual:jar:3.5.0:runtime
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.6.6:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.6.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.6:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.21:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.21:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.29:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.6.6:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.6.6:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.6.6:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.6.0:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.4.8:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:2.4.8:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:9.3:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.21.0:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] |  +- org.mockito:mockito-core:jar:4.0.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.11.22:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.11.22:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:4.0.0:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:5.3.21:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.8.4:test
[INFO] +- org.springframework.cloud:spring-cloud-spring-service-connector:jar:2.0.7.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-connectors-core:jar:2.0.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-context:jar:5.3.21:compile
[INFO] +- org.springframework.cloud:spring-cloud-cloudfoundry-connector:jar:2.0.7.RELEASE:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.13.3:compile
[INFO] |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.3:compile
[INFO] |     \- com.fasterxml.jackson.core:jackson-core:jar:2.13.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:2.6.6:compile
[INFO] |  +- org.springframework:spring-messaging:jar:5.3.21:compile
[INFO] |  \- org.springframework.amqp:spring-rabbit:jar:2.4.3:compile
[INFO] |     +- org.springframework.amqp:spring-amqp:jar:2.4.3:compile
[INFO] |     |  \- org.springframework.retry:spring-retry:jar:1.3.1:compile
[INFO] |     +- com.rabbitmq:amqp-client:jar:5.13.1:compile
[INFO] |     \- org.springframework:spring-tx:jar:5.3.21:compile
[INFO] +- com.sap.cloud.sdk.cloudplatform:scp-cf:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:auditlog-scp-cf:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:auditlog:jar:3.74.0:compile
[INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.36:runtime
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:caching:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:security:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:tenant:jar:3.74.0:compile
[INFO] |  |  \- com.github.ben-manes.caffeine:caffeine:jar:2.9.3:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core-scp-cf:jar:3.74.0:compile
[INFO] |  |  +- com.google.code.gson:gson:jar:2.8.9:compile
[INFO] |  |  +- com.mikesamuel:json-sanitizer:jar:1.2.3:compile
[INFO] |  |  \- com.auth0:java-jwt:jar:3.19.2:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp-cf:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:resilience:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.frameworks:resilience4j:jar:3.74.0:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-bulkhead:jar:1.7.1:runtime
[INFO] |  |  |  +- io.github.resilience4j:resilience4j-cache:jar:1.7.1:runtime
[INFO] |  |  |  |  \- javax.cache:cache-api:jar:1.1.1:runtime
[INFO] |  |  |  \- io.github.resilience4j:resilience4j-ratelimiter:jar:1.7.1:runtime
[INFO] |  |  +- com.sap.cloud.security.xsuaa:token-client:jar:2.12.3:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.11.0:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] |  |  \- com.sap.cloud.security:java-api:jar:2.12.3:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:security-scp-cf:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.security:java-security:jar:2.12.3:compile
[INFO] |  |  \- com.sap.cloud.security:env:jar:2.12.3:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:servlet:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:tenant-scp-cf:jar:3.74.0:compile
[INFO] |  \- com.sap.cloud.sdk.cloudplatform:metering:jar:3.74.0:compile
[INFO] +- com.sap.cloud.sdk.s4hana:s4hana-all:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-core:jar:3.74.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.datamodel:fluent-result:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-connectivity:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-api-odata:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.datamodel:odata-core:jar:3.74.0:compile
[INFO] |  |  \- com.sap.cloud.servicesdk:odata-v2-lib:jar:1.40.11:compile
[INFO] |  |     \- com.sap.cloud.servicesdk:developer_license:jar:1.40.11:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-api-odata-v4:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.datamodel:odata-v4-core:jar:3.74.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.datamodel:odata-client:jar:3.74.0:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:soap:jar:3.74.0:compile
[INFO] |  |  +- org.apache.axis2:axis2-adb:jar:1.7.9:compile
[INFO] |  |  |  \- org.apache.ws.commons.axiom:axiom-dom:jar:1.2.21:runtime
[INFO] |  |  |     \- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.0:runtime
[INFO] |  |  |        \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] |  |  +- org.apache.axis2:axis2-transport-http:jar:1.7.9:compile
[INFO] |  |  +- org.apache.axis2:axis2-kernel:jar:1.7.9:compile
[INFO] |  |  |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.21:compile
[INFO] |  |  |  |  +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.1:compile
[INFO] |  |  |  |  +- jaxen:jaxen:jar:1.2.0:compile
[INFO] |  |  |  |  +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] |  |  |  |  \- org.apache.james:apache-mime4j-core:jar:0.7.2:compile
[INFO] |  |  |  +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.21:runtime
[INFO] |  |  |  +- org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:jar:1.1.2:compile
[INFO] |  |  |  +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1:compile
[INFO] |  |  |  +- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] |  |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] |  |  |  +- org.apache.neethi:neethi:jar:3.0.3:compile
[INFO] |  |  |  \- org.apache.woden:woden-core:jar:1.0M10:compile
[INFO] |  |  \- org.apache.axis2:axis2-transport-local:jar:1.7.9:runtime
[INFO] |  +- com.sap.cloud.sdk.s4hana:rfc:jar:3.74.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.quality:common:jar:3.74.0:compile
[INFO] |  |  |  \- org.apache.commons:commons-csv:jar:1.9.0:compile
[INFO] |  |  \- org.json:json:jar:20220320:compile
[INFO] |  \- com.sap.cloud.servicesdk:odatav2-connectivity-sdk3:jar:1.40.11:compile
[INFO] |     +- com.sap.cloud.servicesdk:jacksonutil-sdk3:jar:1.40.11:compile
[INFO] |     +- joda-time:joda-time:jar:2.9.9:compile
[INFO] |     \- com.sap.cloud.servicesdk.prov:api:jar:1.40.11:compile
[INFO] |        +- javax.transaction:javax.transaction-api:jar:1.3:compile
[INFO] |        +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |        |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |        \- com.sap.cds:cds4j-api:jar:1.13.1:compile
[INFO] +- com.sap.cloud.sdk.cloudplatform:security-servlet:jar:3.74.0:runtime
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  +- com.google.guava:guava:jar:31.1-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] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.15:compile
[INFO] |  \- com.google.errorprone:error_prone_annotations:jar:2.14.0:compile
[INFO] +- io.github.resilience4j:resilience4j-circuitbreaker:jar:1.7.0:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.4:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.4:compile
[INFO] |  \- io.github.resilience4j:resilience4j-core:jar:1.7.0:compile
[INFO] +- io.github.resilience4j:resilience4j-retry:jar:1.7.0:compile
[INFO] +- io.github.resilience4j:resilience4j-timelimiter:jar:1.7.0:compile
[INFO] +- com.sap.cloud.servicesdk.xbem:emjapi-connector-sap-cp:jar:2.0.7:compile
[INFO] +- com.sap.cloud.servicesdk.xbem:emjapi-core:jar:2.0.7:compile
[INFO] |  \- javax.jms:javax.jms-api:jar:2.0.1:compile
[INFO] +- com.sap.cloud.servicesdk.xbem:emjapi-extension-sap-cp-jms:jar:2.0.7:compile
[INFO] |  \- org.apache.qpid:qpid-jms-client:jar:0.54.0:compile
[INFO] |     +- org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:compile
[INFO] |     +- org.apache.qpid:proton-j:jar:0.33.6:compile
[INFO] |     +- io.netty:netty-buffer:jar:4.1.75.Final:compile
[INFO] |     +- io.netty:netty-common:jar:4.1.75.Final:compile
[INFO] |     +- io.netty:netty-handler:jar:4.1.77.Final:compile
[INFO] |     |  +- io.netty:netty-resolver:jar:4.1.75.Final:compile
[INFO] |     |  \- io.netty:netty-codec:jar:4.1.75.Final:compile
[INFO] |     +- io.netty:netty-transport:jar:4.1.75.Final:compile
[INFO] |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.75.Final:compile
[INFO] |     |  +- io.netty:netty-transport-native-unix-common:jar:4.1.75.Final:compile
[INFO] |     |  \- io.netty:netty-transport-classes-epoll:jar:4.1.75.Final:compile
[INFO] |     +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.75.Final:compile
[INFO] |     |  \- io.netty:netty-transport-classes-kqueue:jar:4.1.75.Final:compile
[INFO] |     \- io.netty:netty-codec-http:jar:4.1.75.Final:compile
[INFO] +- com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter:jar:2.11.15:compile
[INFO] |  +- com.sap.cloud.security.xsuaa:spring-xsuaa:jar:2.11.15:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  |  \- com.sap.cloud.security.xsuaa:api:jar:2.11.15:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-security:jar:2.6.6:compile
[INFO] |  |  +- org.springframework.security:spring-security-config:jar:5.7.2:compile
[INFO] |  |  \- org.springframework.security:spring-security-web:jar:5.7.2:compile
[INFO] |  +- org.springframework.security:spring-security-oauth2-jose:jar:5.7.2:compile
[INFO] |  |  +- org.springframework.security:spring-security-core:jar:5.7.2:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:5.7.2:compile
[INFO] |  |  +- org.springframework.security:spring-security-oauth2-core:jar:5.7.2:compile
[INFO] |  |  \- com.nimbusds:nimbus-jose-jwt:jar:9.22:compile
[INFO] |  |     \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |  \- org.springframework.security:spring-security-oauth2-resource-server:jar:5.7.2:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO] \- com.h2database:h2:jar:1.4.200:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.559 s
[INFO] Finished at: 2022-09-30T09:37:23+05:30
[INFO] ------------------------------------------------------------------------

Best Regards, Biswa Ranjan Ray

biswaranjanray commented 2 years ago

Did the info shared on dependency tree helped? Let us know if you need any further input. Would appreciate your help.

Best Regards, Biswa Ranjan Ray

Johannes-Schneider commented 2 years ago

Hi @biswaranjanray,

thanks for providing the Maven dependency tree and please excuse the delayed response - we did have a public holiday yesterday, which is why we didn't have someone to work on your case.

The dependency information indeed helped, as I was able to spot a dependency convergence:

+- com.sap.cloud.sdk.cloudplatform:scp-cf:jar:3.74.0:compile
|  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp-cf:jar:3.74.0:compile
|  |  +- com.sap.cloud.security.xsuaa:token-client:jar:2.12.3:compile
+- com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter:jar:2.11.15:compile

As you can see, the SAP Cloud SDK (version 3.74.0) brings in the Java Security Library in version 2.12.3. Additionally, it seems like you added com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter in version 2.11.5 as a dependency.

So to fix this issue, could you please try using the exact same version for your com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter dependency.


Unrelated to the concrete issue, you might want to consider using the SAP Cloud SDK BOM, which will automatically manage dependency versions so you don't have to. You can find more information about our BOM in our documentation.

Best regards, Johannes

biswaranjanray commented 2 years ago

Hi @Johannes-Schneider,

I worked on the given suggestions and used the same version 2.12.3 for both com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter and com.sap.cloud.security.xsuaa:token-client, but that didn't work.

Additionally I tried excluding com.sap.cloud.security.xsuaa:token-client from com.sap.cloud.sdk.cloudplatform:scp-cf since its managed by com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter also. But that didn't work either.

If it helps please have a look at the dependencies of pom files of sale-service where the issue is caused and the parent pom of the app respectively:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>espm-cn</artifactId>
        <groupId>com.sap.refapps.espm</groupId>
        <version>1.2.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>sale-service</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>com.sap.refapps.espm</groupId>
            <artifactId>commons</artifactId>
            <version>1.2.0</version>
        </dependency>

        <!-- Spring boot starter web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- PostgreSQL -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>

        <!-- Spring boot starter -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <!-- Spring boot starter test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Spring cloud serivce connector -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-spring-service-connector</artifactId>
        </dependency>

        <!-- Spring cloudfoundry connector -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-cloudfoundry-connector</artifactId>
        </dependency>

        <!-- Spring boot starter amqp -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>

        <!-- Cloud SDK -->
        <dependency>
            <groupId>com.sap.cloud.sdk.cloudplatform</groupId>
            <artifactId>scp-cf</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.sap.cloud.security.xsuaa</groupId>
                    <artifactId>token-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.sap.cloud.sdk.s4hana</groupId>
            <artifactId>s4hana-all</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sap.cloud.sdk.cloudplatform</groupId>
            <artifactId>security-servlet</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- Resilience4j CircuitBreaker -->
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-circuitbreaker</artifactId>
        </dependency>

        <!-- Resilience4j Retry -->
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-retry</artifactId>
        </dependency>

        <!-- Resilience4j TimeLimiter -->
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-timelimiter</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sap.cloud.servicesdk.xbem</groupId>
            <artifactId>emjapi-connector-sap-cp</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sap.cloud.servicesdk.xbem</groupId>
            <artifactId>emjapi-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sap.cloud.servicesdk.xbem</groupId>
            <artifactId>emjapi-extension-sap-cp-jms</artifactId>
        </dependency>

        <!-- Spring and XSUAA Security -->
        <dependency>
            <groupId>com.sap.cloud.security.xsuaa</groupId>
            <artifactId>xsuaa-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <!-- h2database -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/libs-milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

And below is the content of parent pom:

<?xml version="1.0" encoding="UTF-8"?>
<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.sap.refapps.espm</groupId>
    <artifactId>espm-cn</artifactId>
    <version>1.2.0</version>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring-boot.version>2.6.6</spring-boot.version>
        <java.version>11</java.version>
        <log4j2.version>2.17.1</log4j2.version>
        <postgresql.version>42.2.19</postgresql.version>
        <version.xbem.client>2.0.7</version.xbem.client>
        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
        <sap.cloud.security.version>2.12.3</sap.cloud.security.version>
        <apache.httpclient.version>4.5.13</apache.httpclient.version>
        <resilience4j.version>1.7.0</resilience4j.version>

        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.testSource>${java.version}</maven.compiler.testSource>
        <maven.compiler.testTarget>${java.version}</maven.compiler.testTarget>

        <surefire.skipTests>false</surefire.skipTests>
        <surefire.forkCount>1</surefire.forkCount>
        <surefire.include>UnitTest.java</surefire.include>
        <surefire.exclude />
        <surefire.groups />
        <surefire.excludedGroups />
        <surefire.maxMemorySize>1024m</surefire.maxMemorySize>
        <surefire.logLevel>info</surefire.logLevel>
        <argLine>-Xmx${surefire.maxMemorySize}
            -Dorg.slf4j.simpleLogger.defaultLogLevel=${surefire.logLevel}</argLine>

        <jacoco.executionDataFile>${project.build.directory}/coverage-reports/jacoco.exec</jacoco.executionDataFile>
        <jacoco.includes>*</jacoco.includes>
        <jacoco.excludes>org.apache.*</jacoco.excludes>

        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
    </parent>

    <modules>
        <module>tax-service</module>
        <module>commons</module>
        <module>product-service</module>
        <module>customer-service</module>
        <module>sale-service</module>
        <module>worker</module>
        <module>gateway</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <!-- Spring cloud service connector -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-spring-service-connector</artifactId>
                <version>2.0.7.RELEASE</version>
            </dependency>

            <!-- Spring cloud cloudfoundry connector -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-cloudfoundry-connector</artifactId>
                <version>2.0.7.RELEASE</version>
            </dependency>

            <!-- Spring retry -->
            <dependency>
                <groupId>org.springframework.retry</groupId>
                <artifactId>spring-retry</artifactId>
                <version>1.3.1</version>
            </dependency>

            <!-- Cloud sdk -->
            <dependency>
                <groupId>com.sap.cloud.sdk</groupId>
                <artifactId>sdk-bom</artifactId>
                <version>3.74.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.6.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- xbem -->
            <dependency>
                <groupId>com.sap.cloud.servicesdk.xbem</groupId>
                <artifactId>emjapi-connector-sap-cp</artifactId>
                <version>${version.xbem.client}</version>
            </dependency>

            <dependency>
                <groupId>com.sap.cloud.servicesdk.xbem</groupId>
                <artifactId>emjapi-core</artifactId>
                <version>${version.xbem.client}</version>
            </dependency>

            <dependency>
                <groupId>com.sap.cloud.servicesdk.xbem</groupId>
                <artifactId>emjapi-extension-sap-cp-jms</artifactId>
                <version>${version.xbem.client}</version>
            </dependency>

            <!-- netty needed while working with JMS of EM https://mvnrepository.com/artifact/io.netty/netty-handler -->
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-handler</artifactId>
                <version>4.1.77.Final</version>
            </dependency>

            <dependency>
                <groupId>com.sap.cloud.db.jdbc</groupId>
                <artifactId>ngdbc</artifactId>
                <version>2.12.7</version>
            </dependency>

            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>2.2</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>2.0.1.Final</version>
            </dependency>

        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <configuration>
                        <rulesets>
                            <ruleset>rulesets/cloud-sdk-qualities.xml</ruleset>
                            <ruleset>rulesets/java/maven-pmd-plugin-default.xml</ruleset>
                        </rulesets>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.sap.cloud.sdk.quality</groupId>
                            <artifactId>pmd-rules</artifactId>
                            <version>3.63.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>SAP Cloud SDK Project Structure Checks</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.5</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>${java.version}</version>
                                </requireJavaVersion>
                                <requireProperty>
                                    <property>project.artifactId</property>
                                    <regex>[^_]+</regex>
                                    <regexMessage>"The artifactId should not contain underscores (_) as this causes issues when deploying to Cloud Foundry."</regexMessage>
                                </requireProperty>

                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Thanks and Regards, Biswa Ranjan Ray

biswaranjanray commented 2 years ago

Please find the repository of the application: https://github.tools.sap/refapps/cloud-espm-cloud-native/tree/jdk11-migration

Johannes-Schneider commented 2 years ago

Hi @biswaranjanray,

thanks for providing the link to your repository.

I just checked it out and - for sanity checking - executed following test (within the sale-service module):

@Test
void defaultHttpClientFactories()
{
    assert(!HttpClientFactory.services.isEmpty());
}

As expected, the test is working just fine and when I debugged the test, I also saw the two expected implementations of the interface available (com.sap.cloud.sdk.cloudplatform.connectivity.CertificateBasedHttpClientFactory and com.sap.cloud.security.client.DefaultHttpClientFactory).

I tested this with both the JDK 11 and the JDK 17. In both cases, everything worked as expected.

I also checked your project and figured that you are not using JCo (and therefore the SAP Java buildpack), which is a common source of class loading and dependency issues.

With all of this checked, I have to admit that I'm pretty clueless of what could be going wrong in your application. Since the original exception is coming from the Security Library I'd therefore ask you to please contact the colleagues directly.

You may of course link this issue so that the colleagues can read up about the context and the attempted resolution steps.

Best regards, Johannes

biswaranjanray commented 2 years ago

Hi @Johannes-Schneider,

Thanks again for your response. Appreciate it. I'll surely contact the concerned team as you suggested.

Just few thoughts. When the app is tried with JDK8 and cloud-sdk 3.74.0 its able to connect to the destination service. Please have a look at the logs below and its found it uses CertificateBasedHttpClientFactory. But apparently its not able to load the right HttpClientFactory with JDK11. Just making assumptions from the logs but I could be wrong also.

   2022-10-07T17:01:17.73+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.734  INFO 8 --- [nio-8080-exec-9] c.s.r.e.s.AbstractSalesOrderService      : applying resilience patterns before calling the tax-service
   2022-10-07T17:01:17.81+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.819  INFO 8 --- [nPool-worker-57] c.s.c.s.c.c.DestinationAccessor          : Creating a new DestinationLoaderChain with EnvVarDestinationLoader as the primary DestinationLoader implementation.
   2022-10-07T17:01:17.82+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.822  INFO 8 --- [nPool-worker-57] c.s.c.s.c.c.DestinationAccessor          : Using an instance of ScpCfDestinationLoader as the secondary DestinationLoader implementation.
   2022-10-07T17:01:17.82+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.822  INFO 8 --- [nPool-worker-57] c.s.c.s.c.c.DestinationAccessor          : Setting the current DestinationLoader used to a custom instance of DestinationLoaderChain.
   2022-10-07T17:01:17.90+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.906  INFO 8 --- [nPool-worker-57] c.s.c.s.t.v.v.JwtAudienceValidator       : configured JwtAudienceValidator with clientId sb-espm-cloud-native-uaa-dest!t11427.
   2022-10-07T17:01:17.90+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:17.906  INFO 8 --- [nPool-worker-57] c.s.c.s.t.v.v.JwtAudienceValidator       : configured JwtAudienceValidator with clientId espm-cloud-native-uaa-dest!t11427.
   2022-10-07T17:01:18.00+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.002  INFO 8 --- [dk-resilience-0] c.s.c.security.client.HttpClientFactory  : loaded HttpClientFactory service providers: [com.sap.cloud.sdk.cloudplatform.connectivity.CertificateBasedHttpClientFactory@3c1e4f7, com.sap.cloud.security.client.DefaultHttpClientFactory@56ad27eb]
   2022-10-07T17:01:18.00+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.002  INFO 8 --- [dk-resilience-0] .s.c.c.CertificateBasedHttpClientFactory : Using CertificateBasedHttpClientFactory service
   2022-10-07T17:01:18.00+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.005  INFO 8 --- [dk-resilience-0] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
   2022-10-07T17:01:18.01+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.019  INFO 8 --- [dk-resilience-0] c.sap.cloud.security.servlet.MDCHelper   : Correlation id (key=correlation_id) was not found in the MDC, generating a new one: de3a1d4d-261b-4e31-be08-74c2efeb8bc7
   2022-10-07T17:01:18.20+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.206  INFO 8 --- [dk-resilience-0] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
   2022-10-07T17:01:18.31+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.312  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ********Destination URI************** https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com
   2022-10-07T17:01:18.31+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.312  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ***********Tax microservice endpoint is https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com/tax.svc/api/v1/calculate/tax?amount=********
   2022-10-07T17:01:18.32+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.321  INFO 8 --- [nPool-worker-57] c.sap.cloud.security.servlet.MDCHelper   : Correlation id (key=correlation_id) was not found in the MDC, generating a new one: 2532b6d3-5111-449b-9904-bae375e8a00b
   2022-10-07T17:01:18.46+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.467  INFO 8 --- [nPool-worker-57] c.s.c.s.c.c.DestinationAccessor          : Setting the current DestinationLoader used to a custom instance of DestinationLoaderChain.
   2022-10-07T17:01:18.46+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.468  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ********Destination URI************** https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com
   2022-10-07T17:01:18.46+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:18.468  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ***********Tax microservice endpoint is https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com/tax.svc/api/v1/calculate/tax?amount=********
   2022-10-07T17:01:19.35+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:19.359  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax service endpoint is https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com/tax.svc/api/v1/calculate/tax?amount=
   2022-10-07T17:01:19.35+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:19.359  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax service is called to calculate tax for amount : 900
   2022-10-07T17:01:19.36+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:19.359  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax amount is : 45.0
   2022-10-07T17:01:23.79+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.790  INFO 8 --- [nPool-worker-57] c.s.c.s.c.c.DestinationAccessor          : Setting the current DestinationLoader used to a custom instance of DestinationLoaderChain.
   2022-10-07T17:01:23.79+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.791  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ********Destination URI************** https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com
   2022-10-07T17:01:23.79+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.791  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : ***********Tax microservice endpoint is https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com/tax.svc/api/v1/calculate/tax?amount=********
   2022-10-07T17:01:23.82+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.821  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax service endpoint is https://espm-tax-service-delightful-gnu-vb.cfapps.eu10.hana.ondemand.com/tax.svc/api/v1/calculate/tax?amount=
   2022-10-07T17:01:23.82+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.821  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax service is called to calculate tax for amount : 900
   2022-10-07T17:01:23.82+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:23.821  INFO 8 --- [nPool-worker-57] c.s.r.e.service.CloudSalesOrderService   : Tax amount is : 45.0
   2022-10-07T17:01:24.44+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:24.443  INFO 8 --- [demand.com:443]] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
   2022-10-07T17:01:24.83+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:24.830  INFO 8 --- [demand.com:443]] org.apache.qpid.jms.JmsConnection        : Connection ID:3da0494e-96db-4ff7-85fe-5998d37eb7ad:1 connected to server: amqpwss://enterprise-messaging-messaging-gateway.cfapps.eu10.hana.ondemand.com:443/protocols/amqp10ws
   2022-10-07T17:01:25.07+0530 [RTR/31] OUT espm-sales-svc-anxious-raven-be.cfapps.eu10.hana.ondemand.com - [2022-10-07T11:31:17.656804583Z] "POST /sale.svc/api/v1/salesOrders HTTP/1.1" 202 146 64 "https://espm-gateway.cfapps.eu10.hana.ondemand.com/webapp/webshop/index.html" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "10.0.200.15:59850" "10.36.133.12:61193" x_forwarded_for:"165.1.238.6, 10.0.72.12, 18.195.244.40, 10.0.200.15" x_forwarded_proto:"https" vcap_request_id:"52796d91-fde8-4f94-6573-cc73ae03cf9e" response_time:7.414840 gorouter_time:0.000035 app_id:"c15458b8-6829-4e12-9a30-f1762ec783e2" app_index:"0" instance_id:"81fb911a-239c-4e01-5a35-b6a1" x_cf_routererror:"-" x_correlationid:"7c3566e0-9df6-4d20-4ff9-5a3262705680" tenantid:"-" sap_passport:"-" x_scp_request_id:"2930e5e8-15ed-4a9b-aa64-8c2bce0e0d5f-63400DFA-AE36E8" x_cf_app_instance:"-" x_forwarded_host:"espm-gateway.cfapps.eu10.hana.ondemand.com" x_custom_host:"-" x_ssl_client:"-" x_ssl_client_session_id:"-" x_ssl_client_verify:"-" x_ssl_client_subject_dn:"-" x_ssl_client_subject_cn:"-" x_ssl_client_issuer_dn:"-" x_ssl_client_notbefore:"-" x_ssl_client_notafter:"-" traceparent:"-" x_b3_traceid:"47b46d9e8ffe4a2e0b4685e5f4b4f040" x_b3_spanid:"0b4685e5f4b4f040" x_b3_parentspanid:"-" b3:"47b46d9e8ffe4a2e0b4685e5f4b4f040-0b4685e5f4b4f040"
   2022-10-07T17:01:25.26+0530 [APP/PROC/WEB/0] OUT 2022-10-07 11:31:25.263  INFO 8 --- [io-8080-exec-10] Spring Security Debugger                 :

Also I'd like to understand your comment as you mentioned you are not using JCo (and therefore the SAP Java buildpack), which is a common source of class loading and dependency issues. We're using community java buildpack. Would you recommend to use SAP Java Buildpack for the usage of Cloud-SDK?

Best Regards, Biswa Ranjan Ray

Johannes-Schneider commented 2 years ago

Hey @biswaranjanray,

thanks for pointing out that everything is indeed working as expected when using Java 8 - as I said, this is very surprising to me and I would have not expected the Java version to make a difference.

Regarding my comment:

you are not using JCo (and therefore the SAP Java buildpack), which is a common source of class loading and dependency issues.

Sorry for the confusion. What I meant is that the SAP Java Buildpack is a common source of issues when it comes to class loading. But since you are not using it, you are also not prone to encounter these issues we are often observing - so you don't have to change anything about your buildpack setup.

Best regards, Johannes

biswaranjanray commented 2 years ago

Hi @Johannes-Schneider,

We could able to fix the issue by replacing java community buildpack with sap java buildpack and following few strategies explained in the cloud-sdk documentation. Thank you very much for your efforts and quick responses.

Best Regards, Biswa Ranjan Ray

Johannes-Schneider commented 2 years ago

Thanks for letting us know, @biswaranjanray!

I'm also glad that you have been able to resolve the issue and found our documentation helpful.