You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/03/23 12:07:38 UTC
[PR] Fix @PreDestroy ClassNotFoundException from premature ClassRealm disposal [maven]
gnodet opened a new pull request, #11825:
URL: https://github.com/apache/maven/pull/11825
## Summary
- `DefaultExtensionRealmCache`, `DefaultPluginRealmCache`, and `DefaultProjectRealmCache` implement Plexus `Disposable`
- Their `dispose()` method called `flush()`, which disposed ClassRealms via `realm.getWorld().disposeRealm()`
- Plexus `Disposable.dispose()` runs **before** Sisu's `@PreDestroy` callbacks, so beans loaded from extension/plugin ClassRealms would get `ClassNotFoundException` when their `@PreDestroy` methods executed
- Fix: `dispose()` now only clears the cache map without disposing realms. The `flush()` method (for explicit cache clearing between builds) remains unchanged.
Fixes #10571
## Test plan
- [ ] Verify plugins with `@PreDestroy` lifecycle methods no longer throw `ClassNotFoundException` at shutdown
- [ ] Verify `flush()` still works correctly for cache clearing between builds (e.g., resident Maven)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix @PreDestroy ClassNotFoundException from premature ClassRealm disposal [maven]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11825:
URL: https://github.com/apache/maven/pull/11825#issuecomment-4623894749
@gnodet Please assign appropriate label to PR according to the type of change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix @PreDestroy ClassNotFoundException from premature ClassRealm disposal [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #11825:
URL: https://github.com/apache/maven/pull/11825
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org