JenaException:属性文件无效
最初几周我和耶拿合作得很好。然而,今天 tomcat 开始出现错误。
我想我已经将范围缩小到:
Caused by: com.hp.hpl.jena.shared.JenaException: Invalid properties file
at com.hp.hpl.jena.util.Metadata.read(Metadata.java:71)
at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:41)
at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:35)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:25)
虽然,我无法弄清楚它意味着哪个属性文件。我从未为 jena 配置过属性文件。我能想到的唯一需要解析的东西是我的 web.xml,它看起来没有错误。
导致错误的代码为:
public void getOntModel()
{
try
{
ssn = ModelFactory.createOntologyModel();
ssn.read(NS);
}
catch(Exception ex)
{
ex.printStackTrace();
System.out.println("[ONTOLOGY] Failed to read ontology file");
}
System.out.println("[ONTOLOGY] Ontology successfully read");
}
具体为:
ssn = ModelFactory.createOntologyModel();
I have been working with Jena fine for the first few weeks. However, today tomcat has started spitting out errors.
I think I've narrowed it down to:
Caused by: com.hp.hpl.jena.shared.JenaException: Invalid properties file
at com.hp.hpl.jena.util.Metadata.read(Metadata.java:71)
at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:41)
at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:35)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:25)
Although, I can't figure out which properties file it means. I've never configured a property file for jena. The only other thing I can think of that requires parsing is my web.xml which doesn't look wrong.
The code that causes the error is:
public void getOntModel()
{
try
{
ssn = ModelFactory.createOntologyModel();
ssn.read(NS);
}
catch(Exception ex)
{
ex.printStackTrace();
System.out.println("[ONTOLOGY] Failed to read ontology file");
}
System.out.println("[ONTOLOGY] Ontology successfully read");
}
Specifically:
ssn = ModelFactory.createOntologyModel();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看源代码:
这就是正在发生的事情:
它似乎正在尝试加载由metadataLocation指定的资源。你能检查一下你的类路径是否正确吗?特别是,检查是否有 Jena 库的混合版本 - 如果有,请重新排序它们,以便最新的位于类路径前面。
如果在某些类 Unix 系统上,您可以使用:
查找包含该属性文件的 jar - 只需将
/path/to/lib
更改为 Jena 库所在的路径。Looking at the source:
This is what is happening:
It seems that it's trying to load the resource specified by metadataLocation. Can you check that your classpath is correct? Especially, check that there are no mixed versions of Jena libraries - if there are, reorder them so the newest are in front of your classpath.
If on some Unix-like system, you can use:
to find the jar that contains that property file - just change
/path/to/lib
to the path where your Jena libraries are located.