java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.utils.XMLUtils
I am getting this error. How to avoid this exception. Please suggest me a solution.
According to Oracle:
NoClassDefFoundErroris thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
In simple language, it means "At compile-time class was there but at run-time, it failed to find/load the class
Question comes : How come my code compile?
Answer maybe because you added jars using Eclipse. But Eclipse does not actually move those jars into you classpath.It just uses those referenced jars while compilation. So your code compiles fine.
After, you move your project to tomcat, when it tries to load some class inside those 'jars', it fails to find the class,because you never moved those jars to the classpath.
Solution:
Move all the libraries(jars) into your project's /WEB-INF/lib. Now all the libraries/jars under /WEB-INF/lib will come under classpath.
You can read more on Oracle's Docs & this article
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With