Java Exception: java.lang.NoSuchFieldError

Posted yexianyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java Exception: java.lang.NoSuchFieldError相关的知识,希望对你有一定的参考价值。

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.

以上是关于Java Exception: java.lang.NoSuchFieldError的主要内容,如果未能解决你的问题,请参考以下文章

java.lang.Exception:检测到明显的连接泄漏错误

Java Exception: java.lang.NoSuchFieldError

java.lang.Exception: Exception in sending Request :: null

java.lang.Exception:测试类应该只有一个公共构造函数

java.lang.Exception:没有找到匹配使用 Intellij IDEA 的方法的测试

matlab报错 Exception “java.lang.ClassNotFoundException: