Compile e substitua o recurso afetado (arquivo JAR) pelo artefato Java atualizado.
Implante o proxy de API como uma nova revisão e faça a chamada de API.
Inicie outra sessão de trace.
Um stack trace está disponível na variável JAVA_STACKTRACE. O stack trace lista a exceção real e o arquivo de origem Java e o número da linha em que o erro é lançado.
Use essas informações para corrigir o problema no código Java.
Neste exemplo, a política JavaCallout falhou devido a uma ArithmeticException (divisão por zero) no arquivo JavaError.java na linha 25.
Resolução
Dependendo da exceção lançada, corrija o problema nos arquivos de origem Java relevantes.
a. No exemplo mostrado acima, o problema foi causado por um erro aritmético (divisão por zero). Acesse o arquivo de origem e o número de linha específicos indicados pelo stack trace.
b. Como não é possível executar a divisão por zero, remova o bloco adicional completo que contenha a linha de código com falha para resolver o problema.
Substitua o arquivo JAR relevante que contém os arquivos modificados no nível apropriado (proxy de API, ambiente ou organização), em que ele existia anteriormente.
Salve e implante o proxy de API como uma nova revisão.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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."]]