Java Exception: java.lang.NoSuchFieldError

来源:互联网 发布:知乎 精华回答 编辑:程序博客网 时间:2024/06/05 02:49

Issue:

When you access static constant in your program, especially in Web app, you may found that some of static field cannot be access. You will get java.lang.NoSuchFieldError exception.

 

Reason:

This exception is usually happened when you build your class into a jar. But you were trying to access same class from Class folder. So JVM may be confused. It might read wrong class which is not contains your field.

 

Solution:

Double check  if there is a duplicate class defined in Jar. And remove one of  duplicate class from your app.