Skip to content

Conversation

@thomasrebele
Copy link
Contributor

What changes were proposed in this pull request?

Ignore NoClassDefFoundError in addition to the already ignored ClassNotFoundException.

Why are the changes needed?

A NoClassDefFoundError is sometimes thrown when debugging tests in Intellij IDEA.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Manually while debugging a qfile test with Intellij IDEA.

@sonarqubecloud
Copy link

@deniskuzZ
Copy link
Member

@thomasrebele, could you please attach the stacktrace

@thomasrebele
Copy link
Contributor Author

Unfortunately I've forgot to save the stacktrace, and I've also forgot which test caused the problem. If I encounter it again, I'll add the stacktrace. It happened at least twice in the last three months, so it's quite likely to happen again.

system.registerGenericUDF("iceberg_zorder",
(Class<? extends GenericUDF>) Class.forName("org.apache.iceberg.mr.hive.udf.GenericUDFIcebergZorder"));
} catch (ClassNotFoundException e) {
} catch (ClassNotFoundException | NoClassDefFoundError e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we should not try to catch instances of Error in application code. Moreover, the Javadoc of NoClassDefFoundError writes the following:

 * The searched-for class definition existed when the currently
 * executing class was compiled, but the definition can no longer be
 * found.

If we get this exception then it seems more like an IDE config issue rather than something that we need to fix here.

@aturoczy
Copy link

aturoczy commented Dec 8, 2025

As I understand here we just swallow the issue if there is the NoClassDefFoundError happened. but if this happens i think it is serious. Or do you have a context why we should silently "handle"?

@thomasrebele
Copy link
Contributor Author

The context would be debugging in the IDE. There were two cases where I arrived at this exception. Once I got it fixed by adding the required jars to the "project structure" in Intellij. The second time I had to run a mvn clean install.

I've seen a few debug options in HiveConf. How about adding a hive.exec.ignore.noclassdeffounderror? The current behavior would stay the same, but the error can be ignored in case of need. Wdyt, @zabetak, @aturoczy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants