我正在尝试使用Windows上的AllegroGraph客户端(版本4.1.1)将*.nt文件导入AllegroGraph。我使用 AllegroGraph WebView 应用程序来启动服务器。首先,我尝试创建一个连接、一个目录和一个存储库。创建存储库后,我的系统会抛出com.franz.agraph.http.exception.AGHttpException
这是我的源代码:
package mytest;
public class NTLoader {
public static String SERVER_URL = "http://localhost:8080";
public static String CATALOG_ID = "";
public static String REPOSITORY_ID = "test3";
public static String USERNAME = "me";
public static String PASSWORD = "xyzzy";
public static String TEMPORARY_DIRECTORY = "";
public static void main(String[] args) {
try {
// Tests getting the repository up.
System.out.println("nStarting example.");
AGServer server = new AGServer(SERVER_URL, USERNAME, PASSWORD);
System.out.println(server.getRootCatalog().getCatalogName());
AGCatalog catalog = server.getCatalog(server.getRootCatalog().getCatalogName());
AGRepository myRepository = catalog.createRepository(REPOSITORY_ID);
} catch (Exception e) {
e.printStackTrace(System.out);
}
输出:
Starting example().
/
org.openrdf.repository.RepositoryException: com.franz.agraph.http.exception.AGHttpException: An unexpected error occurred.
at com.franz.agraph.repository.AGCatalog.createRepository(AGCatalog.java:240)
at com.franz.agraph.repository.AGCatalog.createRepository(AGCatalog.java:211)
at mytest.NTLoader.main(NTLoader.java:86)
Caused by: com.franz.agraph.http.exception.AGHttpException: An unexpected error occurred.
at com.franz.agraph.http.handler.AGErrorHandler.newException(AGErrorHandler.java:70)
at com.franz.agraph.http.handler.AGErrorHandler.handleResponse(AGErrorHandler.java:47)
at com.franz.agraph.http.AGHTTPClient.get(AGHTTPClient.java:180)
at com.franz.agraph.http.AGHTTPClient.getTupleQueryResult(AGHTTPClient.java:376)
at com.franz.agraph.repository.AGCatalog.listRepositories(AGCatalog.java:173)
at com.franz.agraph.repository.AGCatalog.hasRepository(AGCatalog.java:193)
at com.franz.agraph.repository.AGCatalog.createRepository(AGCatalog.java:235)
... 2 more
86号线是
AGRepository myRepository = catalog.createRepository(REPOSITORY_ID);
我如何运行它:
1) 运行 agwebview.exe --port 8080
2) 等待服务器启动
3)运行Java类
我已经用谷歌搜索了一个解决方案,并查看了createRepository()命令的javadoc,但找不到任何解决方案。什么可能导致这种行为,我该如何解决它?
我的操作系统是Windows 7 SP 1,java类运行JDK 1.6
通过切换到Linux并使用最新的AGWebView版本来修复它。后来我发现,我最初将AG 4的客户端用于AG 3.3服务器。
对于遇到此问题的任何其他人:确保使用正确的 JAR 文件