org.apache.jena.atlas.web.HttpException: 405 - 此 URL 不支持 HTTP 方法 POST
org.apache.jena.atlas.web.HttpException: 405 - HTTP method POST is not supported by this URL
我尝试构建 Fuseki 服务器,并向其中添加一些数据。我有构建 Fuseki 的功能
(根据 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;
}
创建后,我想向其中添加一些数据。
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);
}}
我的错误信息是:
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)
我见过这些问题:
但这对我没有帮助。
.add("/data",
然后
uri = "http://host:3332/ds"
一个 "data",另一个 "ds"。
您需要使用相同的服务名称。
错误是 Jetty 拒绝了请求。它没有到达 Fuseki。
我尝试构建 Fuseki 服务器,并向其中添加一些数据。我有构建 Fuseki 的功能
(根据 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;
}
创建后,我想向其中添加一些数据。
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);
}}
我的错误信息是:
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)
我见过这些问题:
但这对我没有帮助。
.add("/data",
然后
uri = "http://host:3332/ds"
"data",另一个 "ds"。
您需要使用相同的服务名称。
错误是 Jetty 拒绝了请求。它没有到达 Fuseki。