Improve diagnostics for unresolved ejb-ref JNDI lookups#26101
Open
renatsaf wants to merge 1 commit into
Open
Conversation
When a remote ejb-ref is resolved only by ejb-link (no jndi-name and no lookup-name), the computed remote JNDI name degenerates to just the '#<interface>' suffix, which is never bound. The resulting failure surfaced only as a cryptic NameNotFoundException for that name. - EjbNamingReferenceManagerImpl: when the ejb-ref is link-only, the resolution exception message now names the ejb-link and states that it was not mapped to a bound JNDI name, with the concrete remedies. - JavaURLContext: log the terminal lookup failure (after all strategies have been tried) at DEBUG, including the per-attempt causes carried as suppressed exceptions, so the reason is available even when callers only report the top-level "No object bound" message. These are diagnostic-only changes; lookup behavior is unchanged. Refs eclipse-ee4j#25190 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a remote appclient
ejb-refis resolved only byejb-link(nojndi-nameand nolookup-name), the lookup fails with a crypticNameNotFoundException: #<interface> not found, and the real reason is not surfaced. Reported in #25190 from EE 11 Persistence TCK runs.The
#<interface>name comes fromEJBUtils.getRemoteEjbJndiName→checkFullyQualifiedJndiName("", "#" + interface): with an empty jndi-name the result degenerates to just the#<interface>suffix, which is never bound. On top of that,JavaURLContext.lookuptries several strategies vialookupOrCollectException, attaching each failure as a suppressed exception on a singleNameNotFoundException("No object bound for …")and discarding the whole collector if any later strategy succeeds — so the actual cause is only present as a suppressed exception on the terminal throw and is never logged.Change
Diagnostics only — lookup behavior is unchanged.
EjbNamingReferenceManagerImpl: when the failing ejb-ref is link-only (isLinked() && !hasJndiName() && !hasLookupName()), the resolution exception now names theejb-linkand states that it was not mapped to a bound JNDI name, with the concrete remedies (add alookup-name/jndi-name, or keep the linked bean in the same application), instead of leaving a bare#<interface>not-found.JavaURLContext: log the terminal lookup failure (after all strategies have been tried) atDEBUG, including the per-attempt causes carried as suppressed exceptions, so the reason is available even when callers only report the top-level "No object bound" message.Logging is intentionally placed only at the terminal failure, not inside
resolveEjbReference, because the collect-and-retry pattern means an earlier attempt failing is not itself an error when a later strategy succeeds.DEBUG(notWARNING) is used becauseNameNotFoundExceptionis frequently an expected, caller-handled outcome.Scope
This addresses the diagnostics request in the issue title. The underlying
ejb-link→ jndi-name binding regression (link-only appclient ejb-refs no longer binding as they did in EE 10) is a separate, larger DOL/appclient fix and is intentionally not part of this PR; the issue is kept open for it.Refs #25190
🤖 Generated with Claude Code