You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Markus Jung (Jira)" <ji...@apache.org> on 2026/07/23 18:43:00 UTC
[jira] [Created] (TOMEE-4658) java:comp/env in web components returns Tomcat's NamingContext, leaking extra bindings and failing close()
Markus Jung created TOMEE-4658:
----------------------------------
Summary: java:comp/env in web components returns Tomcat's NamingContext, leaking extra bindings and failing close()
Key: TOMEE-4658
URL: https://issues.apache.org/jira/browse/TOMEE-4658
Project: TomEE
Issue Type: Bug
Reporter: Markus Jung
When code running in a web component (servlet, filter, JSF managed bean) resolves the {{java:}} namespace, TomEE hands out Tomcat's {{org.apache.naming.NamingContext}} instead of the OpenEJB {{IvmContext}} that an EJB receives for the same names. This exposes two spec deviations against the component naming context:
# *Extra bindings leak into {{java:comp/env}}.* Listing the context returns the internal {{comp}} and {{module}} entries alongside the expected application entries. Where the Enterprise Beans naming-context contract expects 2 {{NameClassPair}} results for the test env context, TomEE returns 4:
{code}
NameClassPair: comp: org.apache.naming.NamingContext
NameClassPair: sub: org.apache.naming.NamingContext
NameClassPair: module: org.apache.naming.NamingContext
NameClassPair: name: java.lang.String
Expecting # of NameClassPair: 2, but actual 4
{code}
# *{{close()}} fails on the servlet-tier context.* Calling {{close()}} on the web component's {{java:}} context throws, whereas the same operation succeeds on the EJB {{IvmContext}}.
The same code paths behave correctly inside an EJB, where the context under test is {{IvmContext{mynode=comp}}}. Only web components are affected.
h3. Reproduce / TCK reference
Excluded per method in {{runner-webprofile/exclusions/enterprise-beans-30.txt}} in the apache/tomee-tck harness repo — the {{close}}, {{list}}, and {{listBindings}} methods of:
* {{**/naming/context/ClientEjbliteservletTest.java}}
* {{**/naming/context/ClientEjbliteservlet2Test.java}}
* {{**/naming/context/JsfClientEjblitejsfTest.java}}
These fail only in the servlet, filtered-servlet, and JSF vehicles; the EJB-invoked variants of the same assertions pass.
h3. Relationship to TOMEE-4654
This is a distinct, read-side gap. TOMEE-4654 made the component naming context read-only, and after that fix all the _write_ assertions (bind, rebind, rename, unbind, createSubcontext, destroySubcontext) in these classes pass in both the EJB and the web vehicles. The remaining failures here are purely about what the web-tier context _lists_ and whether it can be _closed_, which stem from the web component receiving Tomcat's {{NamingContext}} rather than an {{IvmContext}}.
Once fixed, tighten the exclusions above back to the full classes (or remove them) and confirm the naming/context vehicles pass end to end.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)