mojohaus / mojohaus/exec-maven-plugin

NoClassDefFoundError during shutdown

Open
#513 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

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 reported this also to the dnsjava project, but they suspect this should be fixed in the exec-maven-plugin: https://github.com/dnsjava/dnsjava/issues/396#issuecomment-3898664072
A related issue as been reported before in #327, but that appears to be happening before shutdown.

Another user reported a similar issue during shutdown, but not in a separate issue: https://github.com/mojohaus/exec-maven-plugin/issues/327#issuecomment-2674879653

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the shutdown failure with the linked minimal project using mvn compile exec:java. Start at the stack-trace entry points in NioTcpClient.java, NioClient.java, and URLClassLoaderBuilder.java, then compare shutdown behavior with and without the manual NioClient.close() workaround. Done means the executable exits without the NoClassDefFoundError or 10-second hang.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.