Sehen Sie sich die JavaCallout-Richtlinie und die verwendete Ressource an. Im obigen Beispiel verwendet die JavaCallout-Richtlinie eine Ressource namens hello.jar, wie unten dargestellt:
Erfassen und speichern Sie die Java-Ausnahme in einer Ablaufvariable, indem Sie den Quellcode ändern, wie unter Fehler in einem Java-Callout verarbeiten beschrieben.
Kompilieren Sie die betroffene Ressource (JAR-Datei) und ersetzen Sie sie durch das aktualisierte Java-Artefakt.
Sie stellen den API-Proxy als neue Überarbeitung bereit und führen den API-Aufruf aus.
Starten Sie eine weitere Trace-Sitzung.
In der Variablen JAVA_STACKTRACE ist ein Stacktrace verfügbar. Der Stacktrace enthält die tatsächliche Ausnahme und die Java-Quelldatei und die Zeilennummer für den Fehler.
Verwenden Sie diese Informationen, um das Problem im Java-Code zu beheben.
In diesem Beispiel ist die JavaCallout-Richtlinie aufgrund einer ArithmeticException (Teilung durch null) in der Datei JavaError.java in Zeile 25 fehlgeschlagen.
Lösung
Beheben Sie je nach ausgelöster Ausnahme das Problem in den entsprechenden Java-Quelldateien.
a. Im obigen Beispiel wurde das Problem durch einen arithmetischen Fehler verursacht (Teilung durch null). Gehen Sie zur angegebenen Quelldatei und zur Zeilennummer, die vom Stacktrace angegeben wird.
b. Da die Division durch null nicht möglich ist, entfernen Sie den vollständigen Block, der die fehlerhafte Codezeile enthält, um das Problem zu lösen.
Ersetzen Sie die relevante JAR-Datei mit den geänderten Dateien auf der entsprechenden Ebene (API-Proxy, Umgebung oder Organisation), in der sie zuvor vorhanden war.
Speichern und stellen Sie den API-Proxy als neue Überarbeitung bereit.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis documentation addresses troubleshooting for \u003ccode\u003esteps.javacallout.ExecutionError\u003c/code\u003e in Apigee and Apigee hybrid environments, specifically related to JavaCallout policies.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eExecutionError\u003c/code\u003e occurs when Java code within a JavaCallout policy throws an exception or returns \u003cem\u003enull\u003c/em\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDiagnosis involves using a trace session to identify the failing JavaCallout policy and examining the relevant JAR resource, along with capturing the Java exception in a flow variable named \u003ccode\u003eJAVA_STACKTRACE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eResolution requires identifying the specific Java exception and its location (file and line number) from the stack trace, fixing the error in the source code, and updating the corresponding JAR file.\u003c/p\u003e\n"],["\u003cp\u003eThe example given in this document outlines an \u003ccode\u003eArithmeticException\u003c/code\u003e (division by zero), for which you can resolve by removing or correcting the lines of code that cause the error, updating the jar file and deploying a new revision.\u003c/p\u003e\n"]]],[],null,["# JavaCallout policy runtime error troubleshooting\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/runtime/java-callout-runtime-errors) documentation.*\n| **Note:** Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nExecutionError\n--------------\n\n### Error Code\n\n steps.javacallout.ExecutionError\n\n### Error response body\n\n {\n \"fault\": {\n \"faultstring\": \"Execution returned an error result\",\n \"detail\": {\n \"errorcode\": \"flow.execution.ExecutionReturnedFailure\"\n }\n }\n }\n\n### Cause\n\nThis error occurs if Java code throws an exception or returns *null* during the execution of a [JavaCallout policy](/apigee/docs/api-platform/reference/policies/java-callout-policy).\n\n### Diagnosis\n\n1. Start a [trace session](/apigee/docs/api-platform/debug/trace) to capture the error and identify which [JavaCallout policy](/apigee/docs/api-platform/reference/policies/java-callout-policy) has failed.\n\n2. Examine the [JavaCallout policy](/apigee/docs/api-platform/reference/policies/java-callout-policy) and the resource that is used. In the above example, the [JavaCallout policy](/apigee/docs/api-platform/reference/policies/java-callout-policy) uses a resource named `hello.jar`, as shown below:\n\n \u003cJavaCallout name=\"hello-java\"\u003e\n \u003cClassName\u003ecom.apigeesample.HelloJava\u003c/ClassName\u003e\n \u003cResourceURL\u003ejava://hello.jar\u003c/ResourceURL\u003e\n \u003c/JavaCallout\u003e\n\n3. Capture and store the Java exception in a flow variable by modifying the\n source code, as described in\n [Handling errors in JavaCallout policies](/apigee/docs/api-platform/develop/how-handle-java-callout-errors).\n\n4. Compile and replace the affected resource (JAR file) with the updated Java artifact.\n\n5. Deploy the API Proxy as a new revision and make the API call.\n\n6. Start another trace session.\n\n7. Notice that a stack trace is available in the `JAVA_STACKTRACE` variable. The stack trace lists the actual exception and the Java source file and line number at which the error is being thrown.\n\n8. Use this information to fix the issue in the Java code.\n\n9. In this example, the [JavaCallout policy](/apigee/docs/api-platform/reference/policies/java-callout-policy) failed due to an ArithmeticException (division by zero) in the `JavaError.java` file at line #25.\n\n### Resolution\n\n1. Depending on the exception thrown, fix the issue in the relevant Java source file(s).\n a. In the example shown above, the issue was caused by an arithmetic error (division by zero). Go to the specific source file and line number indicated by the stack trace.\n\n b. Since you cannot perform division by zero, remove the complete else block containing the faulty line of code to resolve the problem.\n2. Replace the relevant JAR file containing the modified files at the appropriate level (API proxy, environment or organization), where it previously existed.\n\n3. Save and deploy the API proxy as a new revision."]]