简体   繁体   中英

Strange NoClassDefFoundError exception

I am getting a bizarre case of NoClassDefFoundError exception. My application is deployed on WebLogic 12c and been running there for several months. In one of the classes I am making a static invocation of the method defined in the class which is part of the JAR and that JAR is in the classpath of my Managed Server. Everything was fine until one of a sudden I started to get "NoClassDefFoundError" for that particular class. My JAR hasn't changed, the calling class hasn't changed and the classpath hasn't changed. I checked CLASSPATH thru JVisualVM and my JAR file is there.

I am wondering is there any way to find out why it's happening through Java utilities or some other tools.

If it has been running for a long time, it is possible that your PermGen memory that contains static methods and class definitions has garbage collected that class definition in order to replace it with something else. Once you try to call the static method, that class will once again be initialized but if at the moment of initialization something fails (for example you assign a static field's value from a static method that ends up throwing an exception) then the class won't be initialized and when you try to access it you will get a NoClassDefFoundError .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM