尝试连接到Sesame Repository时出现NoSuchMethodError

时间:2015-01-25 14:36:45

标签: java repository sesame

我在项目中运行以下代码,因为我正在尝试访问sesame服务器中的存储库:

   try{
    String serverUrl = "http://localhost:8080/openrdf-sesame";
    String repositoryID ="200"; 
     RepositoryProvider.getRepositoryManager(serverUrl);
     Repository myRepository =new HTTPRepository(serverUrl,repositoryID);
                myRepository.initialize();
                RepositoryConnection con= myRepository.getConnection();
    }

我甚至使用调试来查找错误的来源,但它看起来来自:

    RepositoryConnection con= myRepository.getConnection();

当我运行代码时,得到以下错误。

HTTP Status 500 -

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.NoSuchMethodError: org.openrdf.model.impl.ValueFactoryImpl.getInstance()Lorg/openrdf/model/impl/ValueFactoryImpl;

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.

1 个答案:

答案 0 :(得分:0)

NoSuchMethodError通常表示您使用不同版本的库正在运行您的程序,而不是编译它。一个常见原因是您的运行时类路径包含同一个库的多个版本,而JRE选择“错误的”。

由于此情况下的错误发生在服务器端,因此您应该查看GlassFish部署,并确保它不包含多个版本的Sesame库。

相关问题