java - 详细 Rexster 输出/记录错误 `null`

标签 java database ubuntu titan rexster

我在规模为 3 的小型 Ubuntu 服务器云中使用 Titan,并将 Rexster 扩展部署到 $TITAN_HOME/ext。但是,如果我尝试调用扩展的端点,我会得到

{"message":"An error occurred while generating the response object","error":null}

这不是很有帮助。如何获得更详细的输出以查看这里出了什么问题?另外,错误 null 对我来说似乎很奇怪。有什么想法会导致它吗?

编辑: 我将导致错误的扩展的整个执行包装在 try-catch-everything block 中:

@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 子句),直到您看到错误.

关于java - 详细 Rexster 输出/记录错误 `null`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28043139/

相关文章:

java - 如何使用 Proguard.cfg 纠正缺少类/方法的问题

java - HashMap 更新 ArrayList

linux - Atom 在 Ubuntu 15.10 上运行速度极慢 - 关于渲染器?

java - 解决 gradle 拥有的项目依赖关系

java - 在 Springboot 和 ehcache 上获取 java.lang.ArrayStoreException

vba - 删除连续的重复项 : "File sharing lock count exceeded" at 9k of 1m records

database - 美国州/县/市/zip 数据库中的数据限制?

MySQL触发器不更新表

python - 通过 ubuntu 应用程序运行的 Matplotlib 弃用警告

ubuntu - 如何使用 ubuntu 在 Skype 中编辑最后发送的消息