1

I have seen this: java.lang.NoClassDefFoundError: Could not initialize class XXX

And this: Different methodologies for solving bugs that only occur in production

But my question is, given what the first answer says about this problem, how could it be that I could be getting that error on only one of the two places? isn't this a pretty serious error that should prevent the program from compiling in any location? (I properly import the class in the file this error occurs.)

What differences between the two environments should I be looking for?

Other questions about the error I'm getting in QA indicate it could be some nested problem with the class itself, but like I said if that was the case why would it only happen in the QA environment? I can run jmeter load/endurance tests against my program all day long locally and not see this error.

Note, I don't handle the deployments to QA, but is there something I should ask the guy who does? Would run config differences be a potential cause?

The logs in splunk aren't super helpful, here's part of the exception of one instance of the error:

[https-jsse-nio-11402-exec-9] 28 Jun 2021 13:29:45,415+0000 ERROR GenericThrowableMapper [{applicationSystemCode=[removed]-app, clientIP=[removed], clusterId=[removed], containerId=[removed], correlationId=[removed], domainName=[removed], hostName=[removed], messageId=[removed], userId=[removed], webAnalyticsCorrelationId=|}]: java.lang.NoClassDefFoundError: Could not initialize class [removed].CDDConfig
    at [removed].execute([removed]AggregationResource.java:77)
    at [removed]AggregationResource$$FastClassBySpringCGLIB$$7a8c5a8e.invoke(<generated>)

It then goes on into package classes and all that for a bunch of lines. I add this to ask - maybe there's something else I should try to have it log?

troyblerg
  • 55
  • 1
  • 2
  • 8

1 Answers1

1

This isn't much more than a spontaneous guess, but judging from experience, I suspect a JDK / JRE version error.

Classic case I witnessed: you compile something on your dev machine with, say, OpenJDK version 8.x.x. You commit / push, the Jenkins CICD pipe starts running, but someone configured its JAVA_HOME to some 11.x version JDK. -> ClassNotFoundError, NoClassDef, etc.

If you do not do the deployment to QA yourself, can you check what JDK the code has been compiled with? Or ask the guy doing it for that info.

ckmuun
  • 21
  • 2