通过Jena权限示例教程时获取NoClassDefFoundError

时间:2018-10-01 19:45:32

标签: java jena

我尝试通过以下示例教程使用Fuseki向Apache Jena添加权限: https://jena.apache.org/documentation/permissions/example.html

按照所有步骤操作之后,第二次使用fuseki-server -config=run/config.ttl启动服务器 我收到以下Java错误:

saphieron@plantlogger:~/semantic/apache-jena-fuseki-3.8.0 $ ./fuseki-server -config=run/config.ttl
    [2018-10-01 21:26:49] Server     INFO  Apache Jena Fuseki 3.8.0
    [2018-10-01 21:26:50] Config     INFO  FUSEKI_HOME=/home/saphieron/semantic/apache-jena-fuseki-3.8.0
    [2018-10-01 21:26:50] Config     INFO  FUSEKI_BASE=/home/saphieron/semantic/apache-jena-fuseki-3.8.0/run
    [2018-10-01 21:26:50] Config     INFO  Shiro file: file:///home/saphieron/semantic/apache-jena-fuseki-3.8.0/run/shiro.ini
    [2018-10-01 21:26:52] Config     INFO  Configuration file: run/config.ttl
    [2018-10-01 21:26:56] Server     ERROR Exception in initialization: org/apache/commons/collections4/map/LRUMap
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections4/map/LRUMap
            at org.apache.jena.permissions.impl.SecuredItemImpl.incrementUse(SecuredItemImpl.java:210)
            at org.apache.jena.permissions.impl.SecuredItemInvoker.invoke(SecuredItemInvoker.java:117)
            at com.sun.proxy.$Proxy1.getGraph(Unknown Source)
            at org.apache.jena.sparql.core.DatasetImpl.<init>(DatasetImpl.java:67)
            at org.apache.jena.query.DatasetFactory.create(DatasetFactory.java:124)
            at org.apache.jena.sparql.core.assembler.DatasetAssembler.createDataset(DatasetAssembler.java:60)
            at org.apache.jena.sparql.core.assembler.DatasetAssembler.open(DatasetAssembler.java:43)
            at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:157)
            at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:144)
            at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:93)
            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.FusekiBuilder.getDataset(FusekiBuilder.java:120)
            at org.apache.jena.fuseki.build.FusekiBuilder.buildDataServiceCustom(FusekiBuilder.java:73)
            at org.apache.jena.fuseki.build.FusekiBuilder.buildDataAccessPoint(FusekiBuilder.java:65)
            at org.apache.jena.fuseki.build.FusekiConfig.servicesAndDatasets(FusekiConfig.java:121)
            at org.apache.jena.fuseki.server.FusekiSystem.processServerConfigFile(FusekiSystem.java:266)
            at org.apache.jena.fuseki.server.FusekiSystem.initServerConfiguration(FusekiSystem.java:237)
            at org.apache.jena.fuseki.server.FusekiSystem.initializeDataAccessPoints(FusekiSystem.java:207)
            at org.apache.jena.fuseki.server.FusekiServerListener.serverInitialization(FusekiServerListener.java:96)
            at org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:53)
            at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
            at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
            at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
            at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
            at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1514)
            at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1476)
            at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
            at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
            at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
            at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
            at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
            at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
            at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
            at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
            at org.eclipse.jetty.server.Server.start(Server.java:449)
            at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
            at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
            at org.eclipse.jetty.server.Server.doStart(Server.java:416)
            at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
            at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:137)
            at org.apache.jena.fuseki.cmd.FusekiCmd.runFuseki(FusekiCmd.java:372)
            at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:356)
            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:104)
            at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:67)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections4.map.LRUMap
            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)
            ... 50 more

Web前端似乎已经加载,但实际上除了index.html之外其他都似乎不可访问。我的问题主要是,在遵循本教程时,是否应该发生所有这些事情,或者应该发生NoClassDefFoundError。我期待某种用户/密码对话框,但无法从端点访问任何数据。 现在,由于我没有任何信息,是否由于我未对自己进行身份验证或服务器无法正常启动而导致访问失败,所以我不确定如何从此处继续。

尝试过:

  • Jena Fuseki 3.8.0
  • commons-collections4-4.2
  • jena-permissions-3.8.0.jar
  • jena-permissions-3.8.0-example.jar
  • java版本“ 1.8.0_65”

1 个答案:

答案 0 :(得分:2)

您的JVM无法找到LRUMap类,该类是 Apache Commons Collections v4 的一部分。请仔细检查提到该库的步骤:

  
      
  1. 下载Apache Commons Collections v4 http://commons.apache.org/proper/commons-collections/download_collections.cgi,将commons-collections * .jar解压缩到Fuseki主目录中。
  2.   

在Linux / Unix上...

  

将MyCode.jar更改为Permissions.jar:example.jar:commons-collections * .jar

或者如果您使用Windows ...

  

将MyCustomCode.jar更改为Permissions.jar; example.jar; commons-collections * .jar

注意:您应将以上各行中的*替换为版本号。因此,您应该改用commons-collections4-4.2.jar

permissions.jar:example.jar:commons-collections4-4.2.jar

permissions.jar;example.jar;commons-collections4-4.2.jar