使用Cloud SDK 3.9.0在S4Hana内部部署的Spring Boot应用程序

时间:2019-12-18 13:46:24

标签: sdk cloud sap cloudfoundry sap-cloud-platform

我正在尝试编写一个Spring Boot应用程序(Gradle),该应用程序将通过云连接器从S4 / Hana本地系统中查询数据。

仅供参考: 我已经在运行Java(Maven)应用程序(例如SAP的示例),运行正常。所以我的云设置应该可以。

将Spring Boot应用程序部署到Cloud Foundry时,出现以下错误消息:

   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT ***************************
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT APPLICATION FAILED TO START
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT ***************************
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT Description:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT An attempt was made to call a method that does not exist. The attempt was made from the following location:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT     com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationLoader.<clinit>(ScpCfDestinationLoader.java:53)
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT The following method did not exist:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT     com.sap.cloud.sdk.cloudplatform.cache.CacheManager.register(Lcom/github/benmanes/caffeine/cache/Cache;)Lcom/github/benmanes/caffeine/cache/Cache;
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT The method's class, com.sap.cloud.sdk.cloudplatform.cache.CacheManager, is available from the following locations:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT     jar:file:/home/vcap/app/BOOT-INF/lib/caching-2.22.0.jar!/com/sap/cloud/sdk/cloudplatform/cache/CacheManager.class
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT     jar:file:/home/vcap/app/BOOT-INF/lib/caching-3.9.0.jar!/com/sap/cloud/sdk/cloudplatform/cache/CacheManager.class
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT It was loaded from the following location:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT     jar:file:/home/vcap/app/BOOT-INF/lib/caching-2.22.0.jar!/
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT Action:
   2019-12-18T13:58:34.26+0100 [APP/PROC/WEB/0] OUT Correct the classpath of your application so that it contains a single, compatible version of com.sap.cloud.sdk.cloudplatform.cache.CacheManager
   2019-12-18T13:58:34.39+0100 [APP/PROC/WEB/0] OUT Exit status 1

我的Spring Boot应用程序类的配置如下: enter image description here

我正在使用这些gradle依赖项:

  compile "com.sap.cloud.sdk.cloudplatform:scp-cf:3.9.0"
  compile "com.sap.cloud.sdk.s4hana:s4hana-all:3.9.0"
  compile "com.sap.cloud.sdk.cloudplatform:caching:3.9.0"
  compile "com.sap.cloud.sdk.cloudplatform:security-servlet:3.9.0"

和manifest.yml看起来像这样: enter image description here

我缺少某些依赖项吗?还是* .yml错误?

1 个答案:

答案 0 :(得分:0)

好的,我找到了原因,但是我不明白为什么这是一个问题: 如果我使用:

DestinationAccessor.tryGetDestination("myDestination")

我得到了错误!当我尝试使用

到达目的地时
DestinationAccessor.getDestination("myDestination")

没有问题!