0

我在一个大小为 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.

很高兴知道,但不是很详细。

4

1 回答 1

1

如果在调用扩展程序期间出现某些故障,您通常会收到该错误。通常,运行 Rexster 的控制台应该提供一些日志消息来解释原因并具有堆栈跟踪。

如果由于某种原因您没有看到这些,我会尝试在您的扩展程序中进行自己的日志记录,并可能更普遍地在您的代码中捕获异常(并在 catch 子句中记录),直到您看到错误为止。

于 2015-01-21T16:28:09.727 回答