Skip to content

Improve diagnostics for unresolved ejb-ref JNDI lookups#26101

Open
renatsaf wants to merge 1 commit into
eclipse-ee4j:mainfrom
renatsaf:improve-jndi-lookup-diagnostics-25190
Open

Improve diagnostics for unresolved ejb-ref JNDI lookups#26101
renatsaf wants to merge 1 commit into
eclipse-ee4j:mainfrom
renatsaf:improve-jndi-lookup-diagnostics-25190

Conversation

@renatsaf

Copy link
Copy Markdown
Contributor

Problem

When a remote appclient ejb-ref is resolved only by ejb-link (no jndi-name and no lookup-name), the lookup fails with a cryptic NameNotFoundException: #<interface> not found, and the real reason is not surfaced. Reported in #25190 from EE 11 Persistence TCK runs.

The #<interface> name comes from EJBUtils.getRemoteEjbJndiNamecheckFullyQualifiedJndiName("", "#" + interface): with an empty jndi-name the result degenerates to just the #<interface> suffix, which is never bound. On top of that, JavaURLContext.lookup tries several strategies via lookupOrCollectException, attaching each failure as a suppressed exception on a single NameNotFoundException("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 the ejb-link and states that it was not mapped to a bound JNDI name, with the concrete remedies (add a lookup-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) 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.

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 (not WARNING) is used because NameNotFoundException is 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant