Reputation: 1389
On one of our production machines we are getting a strange error during runtime I have never seen before.
com/example/MyClass$$Lambda$172
Caused by java.lang.reflect.InvocationTargetException: null
Caused by: java.lang.NoClassDefFoundError: com/example/MyClass$$Lambda$172
Caused by: java.lang.ClassNotFoundException: com.example.MyClass$$Lambda$172
...
I wonder what exactly $$Lambda$$172 means. I assume Lambda refers a generated lambda expression? The 172 then maybe is a line in the generated code? Is there a way to see what exactly is going on there? Looking at MyClass line 172 is just an empty line, so that cannot be it. This is running on JDK 1.8 version 25.261-b09.
In general I would appreciate any hint as to what might be wrong here. Please note, sometimes the same operation succeds and does not throw a a CNFE.
Thanks, Sven
Edit Unfortunately I cannot add a minimal example as this happens on a customers machine and I have never seen this happen during dev or testing.
Where would that nested class be stored after compilation?
Upvotes: 1
Views: 370
Reputation: 1327
The problem here isn't really the class can't be found, but rather the initialization of the class failed. However, this can't happen with a closure itself. A closuret can't have a static initializer. Most likley it's the first usage a particular interface. And that intaface has a static initializer, that in turn uses reflection. That leads to the InvoactionTargetException. Now an ITE is always caused by another exception. That's the root cause, you're actually interested in.
As your information is very sparse, I can only give you a very rough direction here...
Upvotes: 1