我是kura的新手,我一直在尝试使用Amit的MQTT application远程卸载部署包,但我无法这样做。这是我从应用程序发送的请求有效负载 -
dp.name = hello_osgi
job.id = 12345891011L
dp.version = 1.0.0
我在回复主题中收到以下错误 -
-- listing properties --
response.code=500
response.exception.message=java.lang.String cannot be cast to java.lang.Long,
response.exception.stack=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
at org.eclipse.kura.core.deployment.uninstall.DeploymentPackageUninstallOptions.
<init>(DeploymentPackageUninstallOptions.java:38)
at org.eclipse.kura.core.deployment.CloudDeploymentHandlerV2.doExecUninstall(CloudDeploymentHandlerV2.java:594)
at org.eclipse.kura.core.deployment.CloudDeploymentHandlerV2.doExec(CloudDeploymentHandlerV2.java:343)
at org.eclipse.kura.cloud.MessageHandlerCallable.call(Cloudlet.java:270)
at org.eclipse.kura.cloud.MessageHandlerCallable.call(Cloudlet.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) ,
response.code=500
Malformed uninstall request
以下是kura控制台 -
16:12:04,707 [MQTT Call: test-client] INFO CloudServiceImpl:440 - Message arrived on topic: $EDC/amir-kura/test-client/DEPLOY-V2/EXEC/uninstall
16:12:04,709 [pool-3-thread-2] ERROR CloudDeploymentHandlerV2:597 - Malformed uninstall request!
16:12:04,710 [pool-3-thread-2] INFO DataServiceImpl:441 - Storing message on topic :$EDC/#account-name/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26, priority: 1
16:12:04,733 [DataServiceImpl:Submit] INFO MqttDataTransport:512 - Publishing message on topic: $EDC/amir-kura/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26 with QoS: 0
16:12:04,745 [pool-3-thread-2] INFO DataServiceImpl:444 - Stored message on topic :$EDC/#account-name/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26, priority: 1
是否有其他方式发送请求有效负载?
答案 0 :(得分:0)
快速查看DeploymentPackageUninstallOptions表示您将job.id
作为字符串而不是长发送。
而不是
String reqId = "12345891011L";
payload.addMetric("job.id", reqId);
代码应该
long reqId = 12345891011L;
payload.addMetric("job.id", reqId);
或者更好的是,使用已经使用正确类型实现所有方法的KuraUninstallPayload。
我不知道Amit的MQTT UTility,但我认为您可以以某种方式设置变量的类型(或更改其应用程序以设置正确的类型,然后发送拉取请求)。