Jena TDB java.lang.ExceptionInInitializerError

前端 未结 3 1453
孤城傲影
孤城傲影 2020-12-10 19:40

I\'m using Jena TDB for loading an RDF dataset and making SPARQL queries against it. I\'m using the following maven dependency:


    

        
3条回答
  •  囚心锁ツ
    2020-12-10 20:08

    I had the same problem and found that the accepted answer is in general correct but not complete (at least it took me quite a while before I figured out how to apply the tip of the answer correctly). Here is how it works.

    1) You have to add the maven-shade plugin to you pom.xml as demonstrated e.g. in: https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-server/pom.xml

    2) Change the link to the main class in the plugin configuration. The main class is provided via the following lines:

    
              org.apache.jena.fuseki.cmd.FusekiCmd
    
    

    You have to add you main class in the mainClass tag. When now building the project using the maven build command, you will get a jar called your-project-name-VERSION.jar which is the runnable jar you want to have. If you previously worked with a "jar with dependencies", then make sure to run the new one (which does not include the "with dependencies" in the name anymore) as otherwise you will run into the same problem.

提交回复
热议问题