Skip to content

Exception when using dnsjava with exec-maven-plugin #396

Description

@tzaeschke

When running an executable from command line (with mvn compile exec:java) that uses dnsjava I get NoClassDefFoundError during shutdown (and shutdown hangs for 10 seconds):

java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/xbill/DNS/NioTcpClient$ChannelKey
    at org.xbill.DNS.NioTcpClient.closeTcp (NioTcpClient.java:70)
    at org.xbill.DNS.NioClient.runTasks (NioClient.java:174)
    at org.xbill.DNS.NioClient.close (NioClient.java:94)
    at org.xbill.DNS.NioClient.lambda$selector$0 (NioClient.java:64)
    at java.lang.Thread.run (Thread.java:750)
Caused by: java.lang.NoClassDefFoundError: org/xbill/DNS/NioTcpClient$ChannelKey
    at org.xbill.DNS.NioTcpClient.closeTcp (NioTcpClient.java:70)
    at org.xbill.DNS.NioClient.runTasks (NioClient.java:174)
    at org.xbill.DNS.NioClient.close (NioClient.java:94)
    at org.xbill.DNS.NioClient.lambda$selector$0 (NioClient.java:64)
    at java.lang.Thread.run (Thread.java:750)
Caused by: java.lang.ClassNotFoundException: org.xbill.DNS.NioTcpClient$ChannelKey
    at org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader.loadClass (URLClassLoaderBuilder.java:211)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:351)
    at org.xbill.DNS.NioTcpClient.closeTcp (NioTcpClient.java:70)
    at org.xbill.DNS.NioClient.runTasks (NioClient.java:174)
    at org.xbill.DNS.NioClient.close (NioClient.java:94)
    at org.xbill.DNS.NioClient.lambda$selector$0 (NioClient.java:64)
    at java.lang.Thread.run (Thread.java:750)

Minimal example project: https://github.com/tzaeschke/exec-maven-plugin-issue

Workaround

The problem can be avoided by manually calling NioClient.close(); before exiting.

Note

I suspect this is a bug in exec-maven-plugin, see #327, not in dnsjava. However, I wanted to report it here because this issue description may be useful to other dnsjava users. We are using many libraries in our application(s), but dnsjava is the only one that triggers the problem.

Also, the issue in the plugin is open since 2022, so it may not be fixed soon. Maybe there is a way for dnsjava to avoid the problem?

Please feel free to close this issue if it seems inappropriate to report it here.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions