5

CAP deploy error: class java.lang.Integer cannot be cast to class java.lang.Stri...

 1 year ago
source link: https://answers.sap.com/questions/13762992/cap-deploy-error-class-javalanginteger-cannot-be-c.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
2 days ago

CAP deploy error: class java.lang.Integer cannot be cast to class java.lang.String

117 Views

Hi community,

I'm developing a CAP application in SAP Business Application Studio. When I try to deploy the mtar to cloud foundry, the following error occurrs.

Error building cloud application deploy model: class java.lang.Integer cannot be cast to class java.lang.String<br>
image.png

The image below is my project structure.

image.png

As you can see, I made the data model and service definition as simple as possible.

db/data-model.cds

namespace poc;
entity BusinessPartnerBasicData {
  key ID                  : UUID;
}<br>

srv/appl-service.cds

using poc as db from '../db/data-model';

Service ApplicationDataService {
    entity BusinessPartnerBasicData as projection on db.BusinessPartnerBasicData;
}

package.json

{
  "name": "poc-bp",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@sap/cds": "^6",
    "express": "^4",
    "hdb": "^0.19.0"
  },
  "devDependencies": {
    "sqlite3": "^5.0.4"
  },
  "scripts": {
    "start": "cds run",
    "deploy": "cf deploy mta_archives/poc-bp_1.0.0.mtar"
  },
  "engines": {
    "node": "^16.15"
  },
  "eslintConfig": {
    "extends": "eslint:recommended",
    "env": {
      "es2020": true,
      "node": true,
      "jest": true,
      "mocha": true
    },
    "globals": {
      "SELECT": true,
      "INSERT": true,
      "UPDATE": true,
      "DELETE": true,
      "CREATE": true,
      "DROP": true,
      "CDL": true,
      "CQL": true,
      "CXL": true,
      "cds": true
    },
    "rules": {
      "no-console": "off",
      "require-atomic-updates": "off"
    }
  },
  "cds": {
    "requires": {
      "[production]": {
        "db": {
          "kind": "hana-cloud"
        }
      },
      "db": {
        "kind": "sql"
      }
    }
  }
} 

@sap/cds version: 6.3.2
If I create a project from scratch and add data model via 'cds add samples', deployment works fine. So I guess this is caused by my data model. If someone has experienced the same issue, kindly let me know how you handled this.Thanks,Mio


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK