Unable to resolve NoClassDefFoundError for Jena IRIFactory

走远了吗. 提交于 2019-12-08 04:11:14

问题


Below is the stacktrace of the error log I'm getting. If someone can tell what exactly could be causing this because as per the stacktrace I've everything in place.

Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/hpl/jena/iri/IRIFactory
    at net.rootdev.javardfa.uri.IRIResolver.<init>(IRIResolver.java:26)
    at org.odftoolkit.odfdom.pkg.rdfa.SAXRDFaParser.createInstance(SAXRDFaParser.java:57)
    at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:217)
    at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.initialize(OdfManifestDom.java:74)
    at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:132)
    at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.<init>(OdfManifestDom.java:63)
    at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:189)
    at org.odftoolkit.odfdom.pkg.OdfPackage.parseManifest(OdfPackage.java:1219)
    at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:452)
    at org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:422)
    at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:250)
    at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:320)
    at org.odftoolkit.simple.Document.loadDocument(Document.java:328)
    at org.odftoolkit.simple.TextDocument.loadDocument(TextDocument.java:305)
    at com.poc.LetsGetStarted.main(LetsGetStarted.java:13)
Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.iri.IRIFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 15 more

Jar Versions : jena-iri : 1.0.2 , java-rdfa : 0.4

Thanks.


回答1:


I got the reason, I've tried both java-rdfa version 0.4 and 0.5 snapshot but both of them refer to com.hp.hpl.jena.iri.IRIFactory, however in the current packaging IRIFactory is moved to package org.apache.jena.iri.IRIFactory.




回答2:


com/hp/hpl/jena/iri/IRIFactory class is not in any of the JARs specified in the class path.

To find the whether the class IRIFactory is in any of the jar files in the CLASS_PATH 1) In windows extract each jar file and check for the class name 2) In linux use "jar -tvf [jar-file-name] |grep "IRIFactory"

If none of the jar contains the class file, add the correct jar in the class path.



来源:https://stackoverflow.com/questions/24906073/unable-to-resolve-noclassdeffounderror-for-jena-irifactory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!