在 Cloud Foundry 中部署 s4sdk 应用程序时出现问题

Problem deploying s4sdk application in Cloud Foundry

项目生成使用:mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=2.3.1,项目在本地运行良好。为 spring 安全添加了 jars,定义了名称为 "destinations" 的环境并执行了对 S4 Hana 系统的调用,这在本地运行良好。但是,当我通过 cf push 部署它时出现错误,日志如下所示:

2018-09-06T17:16:20.34+0530 [APP/PROC/WEB/0] OUT  =========|_|==============|___/=/_/_/_/
   2018-09-06T17:16:20.34+0530 [APP/PROC/WEB/0] OUT  :: Spring Boot ::        (v2.0.4.RELEASE)
   2018-09-06T17:16:21.05+0530 [APP/PROC/WEB/0] OUT { "written_at":"2018-09-06T11:46:20.949Z","written_ts":100919511280466,"component_type":"application","component_id":"369864de-0a0b-4138-bb98-48928417e366","space_name":"dev","component_name":"mkt-agency-appl","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"1b0be89e-290e-4ae7-98f9-72a107f60e78","container_id":"10.0.138.125","type":"log","logger":"com.sap.cec.mkt.agency.Application","thread":"main","level":"INFO","categories":[],"msg":"Starting Application on 28673099-cf61-4378-41d5-4344 with PID 8 (/home/vcap/app/BOOT-INF/classes started by vcap in /home/vcap/app)" }
   2018-09-06T17:16:21.05+0530 [APP/PROC/WEB/0] OUT { "written_at":"2018-09-06T11:46:21.055Z","written_ts":100919615470771,"component_type":"application","component_id":"369864de-0a0b-4138-bb98-48928417e366","space_name":"dev","component_name":"mkt-agency-appl","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"1b0be89e-290e-4ae7-98f9-72a107f60e78","container_id":"10.0.138.125","type":"log","logger":"com.sap.cec.mkt.agency.Application","thread":"main","level":"DEBUG","categories":[],"msg":"Running with Spring Boot v2.0.4.RELEASE, Spring v5.0.8.RELEASE" }
   2018-09-06T17:16:21.05+0530 [APP/PROC/WEB/0] OUT { "written_at":"2018-09-06T11:46:21.056Z","written_ts":100919616000979,"component_type":"application","component_id":"369864de-0a0b-4138-bb98-48928417e366","space_name":"dev","component_name":"mkt-agency-appl","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"1b0be89e-290e-4ae7-98f9-72a107f60e78","container_id":"10.0.138.125","type":"log","logger":"com.sap.cec.mkt.agency.Application","thread":"main","level":"INFO","categories":[],"msg":"The following profiles are active: cloud" }
   2018-09-06T17:16:23.05+0530 [APP/PROC/WEB/0] OUT { "written_at":"2018-09-06T11:46:23.054Z","written_ts":100921614055008,"component_type":"application","component_id":"369864de-0a0b-4138-bb98-48928417e366","space_name":"dev","component_name":"mkt-agency-appl","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"1b0be89e-290e-4ae7-98f9-72a107f60e78","container_id":"10.0.138.125","type":"log","logger":"org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext","thread":"main","level":"WARN","categories":[],"msg":"Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/home/vcap/app/BOOT-INF/lib/bapi-api-2.3.1.jar!/com/sap/cloud/sdk/s4hana/datamodel/bapi/functions/DefaultForeignExchangeDealGetFunction.class]; nested exception is java.util.zip.ZipException: invalid stored block lengths" }
   2018-09-06T17:16:23.24+0530 [APP/PROC/WEB/0] OUT { "written_at":"2018-09-06T11:46:23.149Z","written_ts":100921709659596,"component_type":"application","component_id":"369864de-0a0b-4138-bb98-48928417e366","space_name":"dev","component_name":"mkt-agency-appl","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"1b0be89e-290e-4ae7-98f9-72a107f60e78","container_id":"10.0.138.125","type":"log","logger":"org.springframework.boot.SpringApplication","thread":"main","level":"ERROR","categories":[],"msg":"Application run failed","stacktrace":["org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/home/vcap/app/BOOT-INF/lib/bapi-api-2.3.1.jar!/com/sap/cloud/sdk/s4hana/datamodel/bapi/functions/DefaultForeignExchangeDealGetFunction.class]; nested exception is java.util.zip.ZipException: invalid stored block lengths","\tat org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454)","\tat org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)","\tat org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275)","\tat org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132)","\tat org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:288)","\tat org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245

如果需要提供任何其他详细信息,请告诉我。

这似乎是您的 Maven 缓存中损坏的库的问题,请参见。 https://github.com/spring-projects/spring-boot/issues/6443 and https://gitter.im/spring-projects/spring-boot/archives/2017/08/03。 要解决此问题,您应该清理 Maven 缓存。 here.

描述了执行此操作的一些选项