castagna / jena-examples

A collection of ready to use, small and self contained examples on how to use Apache Jena
Apache License 2.0
282 stars 126 forks source link

ava.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal #6

Closed premjoy7 closed 8 years ago

premjoy7 commented 8 years ago

Runtime exception, when run example org.apache.jena.examples.ExampleAPI_01

java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.jena.rdf.model.impl.IO_Ctl.callByRefection(IO_Ctl.java:64) at org.apache.jena.rdf.model.impl.IO_Ctl.init(IO_Ctl.java:36) at org.apache.jena.util.FileManager.(FileManager.java:86) at org.apache.jena.examples.ExampleAPI_01.main(ExampleAPI_01.java:31) Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal 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 org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at sun.util.xml.PlatformXmlPropertiesProvider.getLoadingDoc(PlatformXmlPropertiesProvider.java:106) at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:78) at java.util.Properties$XmlSupport.load(Properties.java:1201) at java.util.Properties.loadFromXML(Properties.java:881) at org.apache.jena.util.Metadata.read(Metadata.java:75) at org.apache.jena.util.Metadata.addMetadata(Metadata.java:53) at org.apache.jena.util.Metadata.(Metadata.java:47) at org.apache.jena.JenaRuntime.(JenaRuntime.java:89) at org.apache.jena.riot.system.stream.JenaIOEnvironment.getGlobalConfigPath(JenaIOEnvironment.java:69) at org.apache.jena.riot.system.stream.JenaIOEnvironment.getLocationMapper(JenaIOEnvironment.java:45) at org.apache.jena.riot.system.stream.StreamManager.makeDefaultStreamManager(StreamManager.java:73) at org.apache.jena.riot.system.stream.StreamManager.(StreamManager.java:85) at org.apache.jena.riot.adapters.AdapterFileManager.makeGlobal(AdapterFileManager.java:147) at org.apache.jena.riot.adapters.AdapterFileManager.get(AdapterFileManager.java:106) at org.apache.jena.riot.IO_Jena.wireIntoJena(IO_Jena.java:35) at org.apache.jena.riot.RIOT.init(RIOT.java:66) ... 8 more Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal 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) ... 45 more Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.JenaRuntime at org.apache.jena.util.LocationMapper.getGlobalConfigPath(LocationMapper.java:241) at org.apache.jena.util.LocationMapper.get(LocationMapper.java:69) at org.apache.jena.util.FileManager.makeGlobal(FileManager.java:129) at org.apache.jena.util.FileManager.get(FileManager.java:95) at org.apache.jena.examples.ExampleAPI_01.main(ExampleAPI_01.java:31)

Later, added following dependency in pom.xml to solve this issue.

xml-apis xml-apis 1.4.01