CArtAgO "execLinkedOp failed java.lang.IllegalArgumentException: INTERNAL ERROR: Op Exec Context cannot be restored."

83 views Asked by At

I am trying to execute a remote operation, which means, an operation of another CArtAgO artifact. After the execution of the following @LINK operation an exception is occurring:

@LINK 
void reply() throws OperationException {
    try {
        log("received keepalive back!");
    }
}

CArtAgO is giving the following error message:

ERROR: (ArtifactC) Error on execLinkedOp without parameters! cartago.OperationException: execLinkedOp failed java.lang.IllegalArgumentException: INTERNAL ERROR: Op Exec Context cannot be restored. at cartago.Artifact.execLinkedOp(Artifact.java:964) at camelartifact.CamelArtifact.receiveMsg(CamelArtifact.java:112) at camelartifact.CamelArtifact.access$200(CamelArtifact.java:48) at camelartifact.CamelArtifact$ReadCmd.exec(CamelArtifact.java:207) at cartago.Artifact.await(Artifact.java:831) at camelartifact.CamelArtifact.listenRoutes(CamelArtifact.java:68) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at cartago.ArtifactOpMethod.exec(ArtifactOpMethod.java:39) at cartago.Artifact.doOperation(Artifact.java:407) at cartago.Artifact.access$200(Artifact.java:32) at cartago.Artifact$ArtifactAdapter.doOperation(Artifact.java:1275) at cartago.WorkspaceKernel.serveOperation(WorkspaceKernel.java:1136) at cartago.WorkspaceKernel.access$000(WorkspaceKernel.java:48) at cartago.WorkspaceKernel$EnvironmentController.run(WorkspaceKernel.java:1477)

What exactly is this error "op exec context cannot be restored" and how to fix it?

1

There are 1 answers

0
Cleber Jorge Amaral On

This error typically happens when you are calling execLinkedOp without being a CArtAgO internal thread, e.g., directly from some external Java threads, you should use IBlockingCmd with await methods. You can follow this example.

Another recommendations:

  • use @LINK annotation on external method (the one that is being remotelly called)
  • use @INTERNAL_OPERATION for local methods and execInternalOp() to call them.