java lang NoClassDefFoundError org dom4j io SAXReader
This is very common exception while working with application where document needs to parse. If you are getting exception shown below:
java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
Caused by: java.lang.ClassNotFoundException: org.dom4j.io.SAXReader
java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader at com.wachovia.cib.spt.resource.EQDStringMap.<init>(EQDStringMap.java:62) at com.wachovia.cib.spt.resource.StringMapRegistry.getStringMap(StringMapRegistry.java:87) at com.wachovia.cib.spt.eqd.EQDAbstractCompactBinaryDecoder.decodeMappingData(EQDAbstractCompactBinaryDecoder.java:196) at com.wachovia.cib.spt.eqd.EQDCompactBinaryDecoder.<init>(EQDCompactBinaryDecoder.java:30) at com.wachovia.cib.spt.eqd.EQDCompactBinaryFormatter.decodeDictFromByteArray(EQDCompactBinaryFormatter.java:82) at com.wachovia.cib.spt.communication.EQDDictCompactPofSerializer.deserialize(EQDDictCompactPofSerializer.java:102) at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3306) at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2603) at com.tangosol.io.pof.ConfigurablePofContext.deserialize(ConfigurablePofContext.java:358) at com.tangosol.util.ExternalizableHelper.deserializeInternal(ExternalizableHelper.java:2745) at com.tangosol.util.ExternalizableHelper.fromBinary(ExternalizableHelper.java:261) at com.tangosol.coherence.component.net.extend.RemoteNamedCache$ConverterFromBinary.convert(RemoteNamedCache.CDB:4) at com.tangosol.util.ConverterCollections$ConverterMap.get(ConverterCollections.java:1654) at com.tangosol.coherence.component.net.extend.RemoteNamedCache.get(RemoteNamedCache.CDB:1) at com.tangosol.coherence.component.util.SafeNamedCache.get(SafeNamedCache.CDB:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.wachovia.cib.spt.cacheutil.NamedCacheWrapper.invokeWithRetry(NamedCacheWrapper.java:138) at com.wachovia.cib.spt.cacheutil.NamedCacheWrapper.get(NamedCacheWrapper.java:172) at com.wfs.otc.cache.CacheTests.main(CacheTests.java:24) Caused by: java.lang.ClassNotFoundException: org.dom4j.io.SAXReader 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) ... 22 more
Solution: As you see in the exception is says clearly its not finding class name SAXReader so to fix this exception please include dom4j.jar:
- For maven please include below dependency:
<dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency>
- For other project download and include dom4j-1.6.1.jar or its latest version.
Reference: