使用以下项目生成项目:mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=2.3.1
,该项目在本地运行良好。添加了用于春季安全性的jar,使用名称“ destinations”定义了env并执行了对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
请让我知道是否需要提供其他详细信息。
答案 0 :(得分:4)
这似乎是您的Maven缓存中的库损坏的问题,请参见。 https://github.com/spring-projects/spring-boot/issues/6443和https://gitter.im/spring-projects/spring-boot/archives/2017/08/03。 要解决此问题,您应该清理Maven缓存。 here说明了一些实现此目的的选项。