java.lang.NoSuchMethodError exception resolution

      Whenever Java developers, presumably encountered an error message java.lang.NoSuchMethodError it. Study its source, the problem of error by the JVM are essentially "overall responsibility delegation mechanism" initiated: since a plurality of different versions of placing package classes in class path, and as commons-lang 2.x.jar commons- lang3.x.jar are in the class path, the code uses a method commons-lang3.x class, and this method does not exist in the commons-lang2.x in, and from the commons-lang happen when JVM load the class 2.x.jar loaded class, will throw NoSuchMethodError runtime error.

 

To troubleshoot this problem is more difficult, especially in the case of Web applications, can be used as the system directory classpath more, especially when many class package, the situation is particularly complex: JVM in the end you do not know from which class package loading class files. But I tell most people do not have a easy to use gadget now devote:

 

Attached is a srcAdd.jsp program, you put it in the root of your Web application, you can view the following manner JVM load the specified class from which class package:


  
http://localhost/srcAdd.jsp?className=java.net.URL 

Reproduced in: https: //my.oschina.net/usenrong/blog/197858

Guess you like

Origin blog.csdn.net/weixin_33752045/article/details/92028933