2017-10-22 17 views
0

Fuseki 서버를 구축하고 데이터를 추가하려고했습니다. org.apache.jena.atlas.web.HttpException : 405 - HTTP 메서드 POST가이 URL에서 지원되지 않습니다.

포석

를 구축하는 내 기능 ( https://jena.apache.org/documentation/fuseki2/fuseki-embedded.html의 예 3에 따라)가 :

public static FusekiServer createFusekiServer() { 
     DatasetGraph ds = DatasetGraphFactory.createTxnMem(); 
     DataService dataService = new DataService(ds); 
     dataService.addEndpoint(OperationName.Update, ""); 
     FusekiServer server = FusekiServer.create().setPort(3332).add("/data", dataService).build() ; 

     server.start(); 
     return server; 
    } 

를 생성 한 후, 내가 몇 가지 데이터를 추가 할 수 있습니다. 나는이 문제를 본 적이

Exception in thread "main" org.apache.jena.atlas.web.HttpException: 405 - HTTP method POST is not supported by this URL 
    at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1084) 
    at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:711) 
    at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:655) 
    at org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:192) 
    at org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:182) 
    at org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:91) 

:

public static void main(String[] args) { 
     FusekiSrv fusekiSrv = new FusekiSrv(); 
     String uri = "http://host:3332/ds"; 
     DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(uri); 

     Model model = ontology.loadOntology(pathName); 
     FusekiServer fusekiServer = fusekiSrv.createFusekiServer(); 

     fusekiSrv.sendOntologyToFuseki(accessor, model); 
     fusekiServer.stop(); 

} 

    public static void sendOntologyToFuseki(DatasetAccessor accessor, Model model) { 
      if (accessor != null) { 
       accessor.add(model); 
      }} 

내 오류 메시지는

405 HTTP method PUT is not supported by this URL

getting error HTTP Status 405 - HTTP method GET is not supported by this URL but not used `get` ever?

그러나 그것은 나에게 도움이되지 않았다.

답변

1

.add("/data",

후 하나

uri = "http://host:3332/ds"

"데이터", "DS"다른있다.

동일한 서비스 이름을 사용해야합니다.

오류는 요청을 거부 한 부두입니다. 그것은 Fuseki에 도착하지 않았다.