SAP Cloud Platform 通过 CF CLI 部署 MTAR

SAP Cloud Platform Deploy MTAR via CF CLI

我们在 SAP Cloud Foundry 上有一个演示 MTA 运行。此 MTA 是通过 SAP 提供的 mta_archive_builder 工具构建的,并通过 CF CLI 部署。现在,大约一年后,我们想要更新此 MTA,没什么大不了的,只是属性更新。

在尝试构建和部署任何东西之前,我升级了所有必需的工具。

MTA 构建得很好,但是在部署 MTAR 时,我们的 java 应用程序上传失败。日志指出环境需要一些 ZIP 文件。 mtar 存档只包含 .jar 文件,那些应该是 ZIP 文件吗?如果可以,怎么做?

我已经尝试使用新的 MTA 生成器,但没有成功。出现同样的问题。

cf.exe version 6.45.0+5f9ff16f9.2019-06-03

Listing installed plugins...


plugin      version   command name                 command help
multiapps   2.1.1     bg-deploy                    Deploy a multi-target app using blue-green deployment
multiapps   2.1.1     deploy                       Deploy a new multi-target app or sync changes to an existing one
multiapps   2.1.1     download-mta-op-logs, dmol   Download logs of multi-target app operation
multiapps   2.1.1     mta                          Display health and status for a multi-target app
multiapps   2.1.1     mta-ops                      List multi-target app operations
multiapps   2.1.1     mtas                         List all multi-target apps
multiapps   2.1.1     purge-mta-config             Purge no longer valid configuration entries
multiapps   2.1.1     undeploy                     Undeploy a multi-target app
mta_archive_builder version 1.1.19

  - name: ovinto
    type: java
    path: workspace/ovinto
    parameters:
      memory: 2048M
      disk-quota: 512M
      health-check-type: process
    provides:
      - name: ovinto_api
        properties:
          url: '${default-url}'
    properties:
      SPRING_PROFILES_ACTIVE: sapcloudfoundry
    build-parameters:
      builder: maven
      maven-opts:
        command: [ clean, verify ]
        profiles:
           - sapcf
        defines:
           skipTests: true
      build-result: target/*.jar

重要日志条目:

#2.0#2019 06 06 13:06:36.042#Z#DEBUG#com.sap.cloud.lm.sl.xs2.76178077.MAIN_LOG.uploadAppTask#
######com.sap.cloud.lm.sl.cf.persistence.services.ProcessLogger########flowable-async-job-executor-thread-3###
[UploadAppStep] Error uploading application "ovinto". [failed] "{
  "response_code": "422",
  "response_body": "{\"description\":\"The request is semantically invalid: bits uploaded is not a valid zip file\"}",
  "response": {
    "date": [
      "Thu, 06 Jun 2019 13:06:27 GMT"
    ],
    "content-length": [
      "92"
    ],
    "content-type": [
      "text/plain; charset=utf-8"
    ],
    "connection": [
      "close"
    ]
  }
}"#

问题已在 SAP Community 上得到解答,您可以在这里找到答案: https://answers.sap.com/questions/12705200/deploy-mtar-via-cf-cli.html

基本上,其中一种工具会在 .mtar 存档中创建错误的 jar 文件。解决方案是解压 mtar,使用命令 "zip -FF" 修复 jar 档案,然后将它们重新打包到 .mtar 档案中。