Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Java代码中捕获orbeon中的错误?_Java_Orbeon - Fatal编程技术网

如何从Java代码中捕获orbeon中的错误?

如何从Java代码中捕获orbeon中的错误?,java,orbeon,Java,Orbeon,我有以下配置: <property as="xs:string" name="oxf.fr.detail.process.send-to-myservice.*.*"> set-data-status(status="safe") then send( uri="http://localhost:80/myservice",content="xml", replace="none") then success-message(message="Sav

我有以下配置:

<property as="xs:string" name="oxf.fr.detail.process.send-to-myservice.*.*">
     set-data-status(status="safe")
     then send( uri="http://localhost:80/myservice",content="xml",   replace="none")
     then success-message(message="Saved Successfully")
     recover error-message(message="Save Failed")
</property>
即使myService引发异常,我也会成功保存
消息


如何显示异常情况下的
保存失败

如注释中所述,您希望服务在发生错误时返回HTTP错误代码,而不是接受异常并返回字符串“fail”。我不熟悉您用来编写此服务的框架,但如果您让您的方法在发生错误时抛出异常,这种情况可能会立即发生。

可能是重复的,您正在吞咽异常并返回一个正常字符串。。。调用方法如何知道存在问题?
@RequestMapping(value = "/myservice", method = {RequestMethod.POST},
  produces = XML_CONTENT_TYPE)
@ResponseBody
  public String myservice(HttpServletRequest request,     HttpServletResponse response)
  throws IOException {

try {
  //Some logic
} catch (Exception e) {
  return "fail";
}
return "success";
}