我在研究项目中使用GraphDB Free 8.4.1,有时它无法响应请求 . GraphDB日志中没有错误,没有例外,GraphDB作为具有默认配置的服务器工作台运行 .
但是,我在组件中有异常,即请求GraphDB服务器 .
例外是:
org.eclipse.rdf4j.repository.RepositoryException: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.exportStatements(HTTPRepositoryConnection.java:287)
at org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.getStatements(HTTPRepositoryConnection.java:269)
at x.y.semantic.Repository.loadGraph(Repository.java:90)
发生异常的代码段:
ValueFactory factory = SimpleValueFactory.getInstance();
RepositoryConnection connection = repository.getConnection();
// exception happens in getStatements here:
RepositoryResult<Statement> result = connection.getStatements(null, null, null, true, factory.createIRI(contextURI));
请问,请帮我确定问题所在?
非常感谢你!
1 回答
GraphDB Free具有两个并发连接的限制 . 我怀疑这些问题是由GDB-1975引起的“当执行多个并发查询时,GraphDB Free冻结” . 您可以使用以下方法轻松重现该问题:
代码不会关闭
queryResult
迭代器,因此RDF4J会使连接保持打开状态 . 我建议您使用autocloseable Java构造并始终关闭所有迭代器或升级到修复了错误的8.6或更高版本 .