Causes and solutions of java.lang.NoClassDefFoundError

1. Not all the jar packages that the project depends on have been imported; for
example: java.lang.NoClassDefFoundError: Could not initialize class com.esms.common.util.XmlUtil. When you check this class, you find that this class exists. the mistake is
because in this class inside the method cited method of other jar package, and this is referenced in this jar package just missing, it throws this fault.
The solution: one level to find and import the missing jar package
2, class package does not address
, such as: Do you have a class test.java in com.phome.demo1, then this type of package is com.phome. At
this time, demo1 happens to be that you also have a test.java class under com.phome.demo2, and the package of this class is also com.phome.demo1. In this case, this error will also be thrown. Maybe you will say that this kind of situation will throw this error when writing code. Yes, this situation can be avoided in most cases, but I did encounter it, which is very strange.
Solution: Modify the good name it a recompilation


follow-up to be supplemented. . .

Guess you like

Origin blog.csdn.net/u013804636/article/details/54944699