详细 Rexster output/logging 出现错误 `null`
Verbose Rexster output/logging on error `null`
我在大小为 3 的小型 Ubuntu 服务器云中使用 Titan,并将 Rexster 扩展部署到 $TITAN_HOME/ext
。但是,如果我尝试调用扩展的端点,我会得到
{"message":"An error occurred while generating the response object","error":null}
这不是很有帮助。我怎样才能得到更详细的输出来查看这里出了什么问题?此外,错误 null
对我来说似乎很奇怪。知道是什么原因造成的吗?
编辑:
我将导致错误的扩展的整个执行包装在一个 try-catch-everything 块中:
@ExtensionNaming(
namespace = GraphityExtension.EXT_NAMESPACE,
name = "unfollow")
public class RemoveFollowshipExtension extends GraphityExtension {
@ExtensionDefinition(
extensionPoint = ExtensionPoint.GRAPH)
@ExtensionDescriptor(
description = "Removes a followship between two users.")
public
ExtensionResponse
unfollow(
@RexsterContext RexsterResourceContext content,
@RexsterContext Graph graph,
@ExtensionRequestParameter(
name = "following",
description = "identifier of the user following") String idFollowing,
@ExtensionRequestParameter(
name = "followed",
description = "identifier of the user followed") String idFollowed) {
try {
Graphity graphity = getGraphityInstance((TitanGraph) graph);
Map<String, String> map = new HashMap<String, String>();
try {
map.put(KEY_RESPONSE_VALUE, String.valueOf(graphity
.removeFollowship(idFollowing, idFollowed)));
return ExtensionResponse.ok(new JSONObject(map));
} catch (UnknownFollowingIdException | UnknownFollowedIdException e) {
return ExtensionResponse.error(e);
}
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return ExtensionResponse.error(sw.toString());
}
}
但不断得到
{"message":"","error":null}
在客户端。 rexstitan.log
包含有关这些错误的警告:
com.tinkerpop.rexster.GraphResource - The [graphity:unfollow+*] extension raised an error response.
很高兴知道,但不是很详细。
如果在调用您的扩展程序期间出现故障,您通常会收到该错误。通常,Rexster 运行 所在的控制台应该提供一些日志消息来解释原因并具有堆栈跟踪。
如果您出于某种原因没有看到这些,我会尝试在您的扩展中进行您自己的登录,并可能更普遍地在您的代码中捕获异常(并在 catch 子句中登录),直到您可以看到错误。
我在大小为 3 的小型 Ubuntu 服务器云中使用 Titan,并将 Rexster 扩展部署到 $TITAN_HOME/ext
。但是,如果我尝试调用扩展的端点,我会得到
{"message":"An error occurred while generating the response object","error":null}
这不是很有帮助。我怎样才能得到更详细的输出来查看这里出了什么问题?此外,错误 null
对我来说似乎很奇怪。知道是什么原因造成的吗?
编辑: 我将导致错误的扩展的整个执行包装在一个 try-catch-everything 块中:
@ExtensionNaming(
namespace = GraphityExtension.EXT_NAMESPACE,
name = "unfollow")
public class RemoveFollowshipExtension extends GraphityExtension {
@ExtensionDefinition(
extensionPoint = ExtensionPoint.GRAPH)
@ExtensionDescriptor(
description = "Removes a followship between two users.")
public
ExtensionResponse
unfollow(
@RexsterContext RexsterResourceContext content,
@RexsterContext Graph graph,
@ExtensionRequestParameter(
name = "following",
description = "identifier of the user following") String idFollowing,
@ExtensionRequestParameter(
name = "followed",
description = "identifier of the user followed") String idFollowed) {
try {
Graphity graphity = getGraphityInstance((TitanGraph) graph);
Map<String, String> map = new HashMap<String, String>();
try {
map.put(KEY_RESPONSE_VALUE, String.valueOf(graphity
.removeFollowship(idFollowing, idFollowed)));
return ExtensionResponse.ok(new JSONObject(map));
} catch (UnknownFollowingIdException | UnknownFollowedIdException e) {
return ExtensionResponse.error(e);
}
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return ExtensionResponse.error(sw.toString());
}
}
但不断得到
{"message":"","error":null}
在客户端。 rexstitan.log
包含有关这些错误的警告:
com.tinkerpop.rexster.GraphResource - The [graphity:unfollow+*] extension raised an error response.
很高兴知道,但不是很详细。
如果在调用您的扩展程序期间出现故障,您通常会收到该错误。通常,Rexster 运行 所在的控制台应该提供一些日志消息来解释原因并具有堆栈跟踪。
如果您出于某种原因没有看到这些,我会尝试在您的扩展中进行您自己的登录,并可能更普遍地在您的代码中捕获异常(并在 catch 子句中登录),直到您可以看到错误。