简体   繁体   中英

Why do I get `404 File not found` (through Jena) during Virtuoso checkpoint?

We have a Java app that calls Virtuoso. If it runs some SPARQL query while Virtuoso does a checkpoint, it gives: "com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP: File not found"

My first thought was because CheckpointSyncMode=2 , it blocks the query. But I managed to get this exception when CheckpointSyncMode=1 .

Unfortunately, I'm not able to copy more code than the method call; but I can reproduce it with any SPARQL query.

ResponseResult resultsAndBindings = APIEndpointUtil.call(req, nb, match, contextPath, queryParams);

Here is the stacktrace:

HttpException: 404 File not found
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:446)
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execPost(HttpQuery.java:344)
at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:239)
at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:302)
at com.epimorphics.lda.sources.SourceBase.executeSelect(SourceBase.java:110)
at com.epimorphics.lda.query.APIQuery.requestTotalCount(APIQuery.java:917)
at com.epimorphics.lda.core.APIEndpointImpl.call_revised(APIEndpointImpl.java:112)
at com.epimorphics.lda.core.APIEndpointImpl.call(APIEndpointImpl.java:92)
at com.epimorphics.lda.core.APIEndpointUtil.call(APIEndpointUtil.java:53)

REPRODUCE in a very simple test environment:

I set up an empty Virtuoso instance:

OpenLink Virtuoso Server
Version 07.20.3215-pthreads for Linux as of Jan 20 2016"

CheckpointSyncMode=2 or CheckpointSyncMode=1 doesn't matter; it happens anyway.

Make sure Virtuoso is busy with checkpoint:

#!/bin/bash

while true; do
    isql-vt 1111 dba dba exec="checkpoint;"
done;

Call the endpoint with Jena (with: com.epimorphics.lda:elda-lda:1.3.16 , jena-core:2.10.1 ):

import com.hp.hpl.jena.query.ParameterizedSparqlString;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QuerySolution;

public class Main {

    public static void main(String args[]){

        while(true)
            getPreviousSnapshot();
    }

    public static void getPreviousSnapshot() {

        ParameterizedSparqlString pss = new ParameterizedSparqlString("SELECT DISTINCT ?g WHERE {  GRAPH ?g {    ?s ?p ?o  }}");

        System.out.println("Executing SPARQL query:" + pss.toString());

        QueryExecution qe = QueryExecutionFactory.sparqlService("http://33.33.33.11:8890/sparql", pss.asQuery());
        com.hp.hpl.jena.query.ResultSet resultSet = qe.execSelect();

        processResultSet(resultSet);
        qe.close();

    }

    private static void processResultSet(com.hp.hpl.jena.query.ResultSet results) {

        while (results.hasNext()) {
            QuerySolution qs = results.next();
            String s = qs.getResource("g").toString();
            System.out.println(s);

        }
    }
}

Output:

Executing SPARQL query:SELECT DISTINCT ?g WHERE {  GRAPH ?g {    ?s ?p ?o  }}
http://www.openlinksw.com/schemas/virtrdf#
http://www.w3.org/ns/ldp#
http://localhost:8890/sparql
http://localhost:8890/DAV/
http://www.w3.org/2002/07/owl#
Executing SPARQL query:SELECT DISTINCT ?g WHERE {  GRAPH ?g {    ?s ?p ?o  }}
Exception in thread "main" HttpException: 404 File not found
    at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:446)
    at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:289)
    at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:240)
    at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:302)
    at Main.getPreviousSnapshot(Main.java:21)
    at Main.main(Main.java:11)

根据我在virtuoso邮件列表上得到的答案:Jena在Virtuoso由于执行检查点而暂时无法访问时,无法连接到SPARQL服务(这在Virtuoso中是原子动作),因此仅返回404错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM