问题描述
我想使用pelse推理器和我的Fuseki 2.3.1
首先:我在我的config.ttl中添加了Pellet推理器:
ja:reasoner
[ja:reasonerClass
org.mindswap.pellet.jena.PelletReasonerFactory;]
所以现在我必须将Pellet的jar添加到fuseki
这个页面解释了如何将jar(不是特定的pellete)添加到fuseki
所以我很喜欢这个line
我没有注意到这一行
and I uncommet this line
and uncomment the line that starts with APPJAR=
now I still need to know and download the jars for Pellete, I found this link https://datababel.wordpress.com/2013/06/26/fuseki-using-pellet-inference/ that says which are the jars,
I downloaded the lastest available version from maven, which are:
pellet-jena-ignazio1977-2.4.0-ignazio1977.jar
pellet-rules-2.3.6-ansell.jar
pellet-el-2.3.6-ansell.jar
pellet-datatypes-2.3.6-ansell.jar
pellet-core-ignazio1977-2.4.0-ignazio1977.jar
aterm-java-1.8.2-p1.jar
commons-collections4-4.1-javadoc.jar
commons-collections4-4.1.jar
and I added them to fuseki-server script like this:
APPJAR=pellet-jena-ignazio1977-2.4.0-ignazio1977.jar:pellet-rules-2.3.6-ansell.jar:pellet-el-2.3.6-ansell.jar:pellet-datatypes-2.3.6-ansell.jar:pellet-core-ignazio1977-2.4.0-ignazio1977.jar:aterm-java-1.8.2-p1.jar:commons-collections4-4.1-javadoc.jar:commons-collections4-4.1.jar
(they are in the home directory of fuseki)
I run ./fuseki-server, and I get this error
[2016-03-30 16:49:06] Server INFO Fuseki 2.3.1 2015-12-08T09:24:07+0000
[2016-03-30 16:49:07] Config INFO FUSEKI_HOME=/usr/local/apache-jena-fuseki-2.3.1
[2016-03-30 16:49:07] Config INFO FUSEKI_BASE=/usr/local/apache-jena-fuseki-2.3.1/run
[2016-03-30 16:49:07] Servlet INFO Initializing Shiro environment
[2016-03-30 16:49:07] Config INFO Shiro file: file:///usr/local/apache-jena-fuseki-2.3.1/run/shiro.ini
[2016-03-30 16:49:07] Config INFO Load configuration: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl
[2016-03-30 16:49:07] AssemblerHelp WARN ja:loadClass: Migration to Jena3: Converting com.hp.hpl.jena.tdb.TDB to org.apache.jena.tdb.TDB
[2016-03-30 16:49:07] Server ERROR Exception in initialization: com/hp/hpl/jena/reasoner/ReasonerFactory
Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/hpl/jena/reasoner/ReasonerFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.jena.assembler.assemblers.AssemblerBase.loadClass(AssemblerBase.java:109)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactoryByClassName(ReasonerFactoryAssembler.java:140)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactory(ReasonerFactoryAssembler.java:131)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.open(ReasonerFactoryAssembler.java:50)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasonerFactory(InfModelAssembler.java:53)
at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasoner(InfModelAssembler.java:46)
at org.apache.jena.assembler.assemblers.InfModelAssembler.openEmptyModel(InfModelAssembler.java:34)
at org.apache.jena.assembler.assemblers.ModelAssembler.openModel(ModelAssembler.java:36)
at org.apache.jena.assembler.assemblers.ModelAssembler.open(ModelAssembler.java:43)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:35)
at org.apache.jena.sparql.core.assembler.DatasetAssembler.createDataset(DatasetAssembler.java:59)
at org.apache.jena.sparql.core.assembler.DatasetAssembler.open(DatasetAssembler.java:43)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.fuseki.build.Builder.buildDataService(Builder.java:75)
at org.apache.jena.fuseki.build.Builder.buildDataAccessPoint(Builder.java:60)
at org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:249)
at org.apache.jena.fuseki.build.FusekiConfig.readConfigurationDirectory(FusekiConfig.java:223)
at org.apache.jena.fuseki.server.FusekiServer.initializeDataAccessPoints(FusekiServer.java:212)
at org.apache.jena.fuseki.server.FusekiServerListener.init(FusekiServerListener.java:78)
at org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:46)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:835)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:808)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1368)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1335)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:511)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:405)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:372)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:120)
at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:359)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:95)
at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:60)
Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.reasoner.ReasonerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 71 more
Any help please
Hint: I dont know if what I tried is correct of not, all I want is to include Pellet reasoner into fuseki
Update
After ignazio told me that I am mixing the jars,
I went to Pellet git hut and download the src and used maven to complie and get the jars
Then I changed the jar that I am using to :
commons-collections4-4.1-javadoc.jar:commons-collections4-4.1.jar:pellet-cli-2.4.0-SNAPSHOT.jar:jena-core-2.13.0.jar:pellet-jena-2.4.0-SNAPSHOT.jar:pellet-modularity-2.4.0-SNAPSHOT.jar:pellet-owlapi-2.4.0-SNAPSHOT.jar:pellet-pellint-2.4.0-SNAPSHOT.jar
but I got this exception:
[2016-03-30 17:42:09] AssemblerHelp WARN ja:loadClass: Migration to Jena3: Converting com.hp.hpl.jena.tdb.TDB to org.apache.jena.tdb.TDB
[2016-03-30 17:42:10] RDFDefaultErrorHandler WARN unknown-source: {W136} Relative URIs are not permitted in RDF: specifically <ont-policy.rdf>
[2016-03-30 17:42:10] Server ERROR Exception in initialization: expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory
[2016-03-30 17:42:10] WebAppContext WARN Failed startup of context o.e.j.w.WebAppContext@5bcde458{/,file:///usr/local/apache-jena-fuseki-2.3.1/webapp/,STARTING}
org.apache.jena.assembler.exceptions.NotExpectedTypeException: expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory
doing:
root: 79f74f0ed3a21ef24b1cbccda7d37b62 with type: http://jena.hpl.hp.com/2005/11/Assembler#ReasonerFactory assembler class: class org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler
root: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl#model_inf with type: http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class org.apache.jena.assembler.assemblers.InfModelAssembler
root: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl#dataset with type: http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class org.apache.jena.sparql.core.assembler.DatasetAssembler
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.mustBeReasonerFactory(ReasonerFactoryAssembler.java:169)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactoryByClassName(ReasonerFactoryAssembler.java:141)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactory(ReasonerFactoryAssembler.java:131)
at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.open(ReasonerFactoryAssembler.java:50)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasonerFactory(InfModelAssembler.java:53)
at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasoner(InfModelAssembler.java:46)
at org.apache.jena.assembler.assemblers.InfModelAssembler.openEmptyModel(InfModelAssembler.java:34)
at org.apache.jena.assembler.assemblers.ModelAssembler.openModel(ModelAssembler.java:36)
at org.apache.jena.assembler.assemblers.ModelAssembler.open(ModelAssembler.java:43)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:35)
at org.apache.jena.sparql.core.assembler.DatasetAssembler.createDataset(DatasetAssembler.java:59)
at org.apache.jena.sparql.core.assembler.DatasetAssembler.open(DatasetAssembler.java:43)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
at org.apache.jena.fuseki.build.Builder.buildDataService(Builder.java:75)
at org.apache.jena.fuseki.build.Builder.buildDataAccessPoint(Builder.java:60)
at org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:249)
at org.apache.jena.fuseki.build.FusekiConfig.readConfigurationDirectory(FusekiConfig.java:223)
at org.apache.jena.fuseki.server.FusekiServer.initializeDataAccessPoints(FusekiServer.java:212)
at org.apache.jena.fuseki.server.FusekiServerListener.init(FusekiServerListener.java:78)
at org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:46)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:835)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:808)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1368)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1335)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:511)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:405)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:372)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:120)
at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:359)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:95)
at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:60)
[2016-03-30 17:42:10] Server INFO Started 2016/03/30 17:42:10 WEST on port 3030
The error you have is
expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory
I'm no expert but it looks like the Pellet factory for Jena currently in your classpath does not match the expected class.
Which version of Jena comes with Fuseki, and which version is currently used by Pellet?
这篇关于Fuseki如何添加Pellet推理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!