【问题标题】:Returning 404 error when asking for userboostrap in microservices在微服务中请求 userboostrap 时返回 404 错误
【发布时间】:2018-11-22 21:21:16
【问题描述】:

我正在尝试开发积聚性微服务。 我正在关注这个https://cumulocity.com/guides/microservice-sdk/java/。 我能够创建具有此响应的应用程序

"availability": "MARKET",
"id": "23",
"key": "TESTMICRO-microservice-key",
"manifest": {
"imports": [],
"noAppSwitcher": true
},
"name": "TESTMICRO",
"owner": {
"self": "my_tenant/tenant/tenants/management",
"tenant": {
"id": "management"
}
},
"requiredRoles": [
"ROLE_INVENTORY_READ"
],
"roles": [
"ROLE_CUSTOM_MICROSERVICE"
],
"self": "my_tenant/application/applications/23",
"type": "MICROSERVICE"
}

尽管如此,当我尝试 GET URL/application/applications/23/bootstrapUser 时,它会返回 404 错误。

谁能帮帮我?

【问题讨论】:

  • 通常 404 响应代码与未找到寻址资源有关。您确定您的应用程序 ID 是“23”吗?当你查询 GET /application/applications/23 时会发生什么
  • 您是否也向租户订阅了应用程序/微服务?
  • { “可用性”:“市场”,“id”:“28”,“key”:“test28-key”,“manifest”:{“imports”:[],“noAppSwitcher” : true }, "name": "test28", "owner": { "self": "{{url}}/tenant/tenants/management", "tenant": { "id": "management" } }, “requiredRoles”:[“ROLE_INVENTORY_READ”],“角色”:[“ROLE_CUSTOM_MICROSERVICE”],“self”:“{{url}}/application/applications/28”,“type”:“MICROSERVICE”}

标签: http-status-code-404 microservices cumulocity


【解决方案1】:

您可能需要将应用程序订阅到租户:

POST {{url}}/tenant/tenants/{{tenant}}/applications

身体

{
   "application": {
      "id": "{APPLICATION_ID}"
   }
}

【讨论】:

  • 如果我尝试这个,我会得到 415 Unsupported Media Type。尽管如此,需要 GET /application/applications/28 应用程序具有 "tenant":{"id":"management"} 正在管理我希望它位于的租户
  • 您是否使用了 HTTP 标头“Content-type”:“application/json”。在您的情况下,上面提到的 APPLICATION_ID 将是 23。你能检索到 bootstrapUser 吗?
猜你喜欢
  • 2020-03-09
  • 1970-01-01
  • 2013-06-09
  • 2010-10-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-20
  • 1970-01-01
相关资源
最近更新 更多