Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2026 Contributors to the Eclipse Foundation
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -180,6 +180,10 @@ public Object lookup(String name) throws NamingException {
return obj;
}
}
// All strategies failed. The collector carries the cause of each attempt as a suppressed
// exception; log them here so the reason is available even when callers only report the
// top-level "No object bound" message.
LOG.log(Level.DEBUG, () -> "No naming strategy could resolve '" + name + "'.", e);
throw e;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation.
* Copyright (c) 2022, 2025, 2026 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -150,9 +150,19 @@ public Object resolveEjbReference(EjbReferenceDescriptor ejbRefDesc, Context con

} catch(Exception e) {
// Important to make the real underlying lookup name part of the exception.
NamingException ne = new NamingException("Exception resolving Ejb for '" +
ejbRefDesc + "' . Actual (possibly internal) Remote JNDI name used for lookup is '" +
remoteJndiName + "'");
StringBuilder msg = new StringBuilder("Exception resolving Ejb for '").append(ejbRefDesc)
.append("'. Actual (possibly internal) Remote JNDI name used for lookup is '")
.append(remoteJndiName).append('\'');
if (ejbRefDesc.isLinked() && !ejbRefDesc.hasJndiName() && !ejbRefDesc.hasLookupName()) {
// With no jndi-name or lookup-name, the remote name above degenerates to just
// the '#<interface>' suffix, which is never bound. Spell out the real cause
// rather than leaving a cryptic NameNotFoundException for that name.
msg.append(". The reference is resolved only by ejb-link '").append(ejbRefDesc.getLinkName())
.append("', but that link was not mapped to a bound JNDI name. Add a lookup-name")
.append(" (or jndi-name) to the reference, or make sure the linked bean is part of")
.append(" the same application so the ejb-link can be resolved.");
}
NamingException ne = new NamingException(msg.toString());
ne.initCause(e);
throw ne;
} finally {
Expand Down
Loading