2016-07-25 23 views
0

Wir haben eine Java-App, die Virtuoso aufruft. Wenn es eine SPARQL-Abfrage ausführt, während Virtuoso einen Prüfpunkt ausführt, gibt es "com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP: File not found"Warum bekomme ich `` 404 Datei nicht gefunden '' (über Jena) während Virtuoso Checkpoint?

Mein erster Gedanke war, weil CheckpointSyncMode=2 blockiert die Abfrage. Aber ich habe es geschafft, diese Ausnahme zu bekommen, wenn CheckpointSyncMode=1.

Leider kann ich nicht mehr Code als den Methodenaufruf kopieren; aber ich kann es mit jeder SPARQL-Abfrage reproduzieren. Hier

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

ist die 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) 

REPRODUZIEREN in einer sehr einfachen Testumgebung:

ich eine leere Virtuoso Instanz einzurichten:

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

CheckpointSyncMode=2 oder CheckpointSyncMode=1 doesn Es ist egal. es passiert trotzdem.

sicher Virtuoso Stellen beschäftigt sich mit Prüfpunkt:

#!/bin/bash 

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

Rufen Sie den Endpunkt mit Jena (mit: 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); 

     } 
    } 
} 

Ausgang:

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) 
+0

Ohne den ganzen Code zu sehen, wo Sie es nennen und die Fehler-Stack-Trace, unmöglich zu helfen ... – AKSW

+0

danke für das Feedback, aktualisiert die Frage. –

+0

Der Fehler sagt "HttpException: 404 Datei nicht gefunden"; Ich vermute, dass Sie den falschen Endpunkt-URI haben. Ohne mehr Code ist es jedoch unmöglich zu sagen. –

Antwort

0

Nach die antwort habe ich auf die virtuose mailingliste bekommen: Jena bekommt keine verbindung an den SPARQL-Dienst zu der Zeit, zu der Virtuoso aufgrund eines Prüfpunkts (der eine atomare Aktion in Virtuoso ist) vorübergehend nicht erreichbar ist und daher einfach einen 404-Fehler zurückgibt.