sap-business-technology-platformsap-cloud-foundry

SAP Cloud Platform Deploy MTAR via CF CLI


We had a demo MTA running on SAP Cloud Foundry. This MTA was build via the mta_archive_builder tool provided by SAP and deployed via the CF CLI. Now, about a year later, we want to update this MTA, nothing major, just a properties update.

Before I tried building and deploying anything, I upgraded all the required tools.

The MTA builds just fine, but when deploying the MTAR, the upload of our java application(s) fails. The logs states that the environment expects some ZIP file. The mtar archive only holds .jar files, should those be ZIP's? If so, how?

I already tried using the new MTA builder, without any luck. The same problem occurs.

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

Important log entry:

#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"
    ]
  }
}"#

Solution

  • The question has been answered on the SAP Community, you can find the answer here: https://answers.sap.com/questions/12705200/deploy-mtar-via-cf-cli.html

    Basically one of the tools creates faulty jar files within the .mtar archive. The solution is to unpack the mtar, fix the jar archives with the command "zip -FF" and repack them into the .mtar archive.