09-06-2018 07:51 AM
com.tailf.maapi.MaapiException: No such transaction
at com.tailf.maapi.MaapiException.mk(MaapiException.java:61)
at com.tailf.maapi.MaapiException.mk(MaapiException.java:50)
at com.tailf.maapi.Maapi.attach(Maapi.java:980)
at com.example.SFPAdvanced.SFPAdvancedRFS.offlineConfigGeneration(SFPAdvancedRFS.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.tailf.dp.annotations.ActionCallbackProxy.action(ActionCallbackProxy.java:125)
at com.tailf.dp.DpActionTrans.protoCallback(DpActionTrans.java:319)
at com.tailf.dp.DpActionTrans.read(DpActionTrans.java:223)
at com.tailf.dp.DpActionTrans.run(DpActionTrans.java:128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at com.tailf.dp.DpThread.run(DpThread.java:41)
Solved! Go to Solution.
09-06-2018 08:11 AM
09-06-2018 08:11 AM
09-06-2018 08:22 AM - edited 09-06-2018 08:24 AM
@ActionCallback(callPoint="SFP-Advanced-ping", callType=ActionCBType.ACTION)
public ConfXMLParam[] ping(DpActionTrans trans, ConfTag name,
ConfObject[] kp, ConfXMLParam[] params)
throws DpCallbackException {
int tid = trans.getTransaction();
try {
String virtualDeviceName = maapi.getElem(tid, "/services/cloud{%x}/device", kp[0]).toString();
maapi.attach(tid, 0, trans.getUserInfo().getUserId());
ConfPath actionPath = new ConfPath("/devices/device{%x}/live- status/ios-stats:exec/ios-stats:ping", virtualDeviceName);
String ip = params[0].getValue().toString();
ConfList args = new ConfList();
args.addElem(new ConfBuf(ip));
ConfXMLParam[] p = new ConfXMLParam[] { new ConfXMLParamValue("ios-stats", "args", args) };
ConfXMLParam[] actionResult = maapi.requestAction(p, actionPath.toString());
String status = actionResult[0].getValue().toString(); LOGGER.debug("PING:\n" + status);
params = new ConfXMLParam[] { new ConfXMLParamValue(SFPAdvanced.prefix, "result", new ConfBuf(status)) };
maapi.detach(tid);
} catch (IOException e) {
// TODO Auto-generated catch block
} catch (ConfException e) {
// TODO Auto-generated catch block
}catch (Exception e) {
throw new DpCallbackException("ping failed", e);
}
return params;
}
above is the code where DpActionTrans class we are getting transaction id but when this action is triggered from rest api call i see -1 is the transaction id .....Can you please guide me how to start transaction and session ? what are the api to do that
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide