[ https://issues.apache.org/jira/browse/TOMEE-2087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Svetlin Zarev updated TOMEE-2087: --------------------------------- Summary: IvmContext.list() does not correctly list the context content (was: TomEE's naming binds objects in wrong contexts) > IvmContext.list() does not correctly list the context content > ------------------------------------------------------------- > > Key: TOMEE-2087 > URL: https://issues.apache.org/jira/browse/TOMEE-2087 > Project: TomEE > Issue Type: Bug > Reporter: Svetlin Zarev > Priority: Critical > Attachments: sample.zip > > > NameNode has some weird logic based on comparing hash codes, which > determines if the object has to be bound in lessTree, grtrTree, etc. The > issue is that it does not work correctly and binds the objects in the wrong > contexts. For instance if lessTree/grtrTree is not null and is a NameNode > representing a subcontext, it will bind the object to that subcontext which > is incorrect. > Context.lookup() seems to work because NameNode's bind()/resolve() follow the > same logic, but if you inspect the naming context with Context.list() - which > returns the correct information about the subcontexts, you'll see that some > contexts have more name class pairs than they should. > To give an example: > Expected context content: > {code} > ### Context: /module > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB!org.example.TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.naming.NamingContext [looking up: env] > [Value]: org.apache.naming.NamingContext@1bb2d0a8 > ### Context: /module/env > Name: name Class=java.lang.String [looking up: name] [Value]: > module-env > {code} > Actual context content: > {code} > ### Context: /module > Name: global Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: global] > Failed to lookup: global > Name: dummy Class=java.lang.String [looking up: dummy] > Failed to > lookup: dummy > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: env] [Value]: IvmContext{mynode=} > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > ### Context: /module/env > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] > Failed to lookup: > TestEJB!org.example.TestEJB > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] > Failed to lookup: TestEJB > Name: name Class=java.lang.String [looking up: name] [Value]: > module-env > {code} > Note the "failed too lookup..." messages - these are all objects that MUST > NOT be bound in that context. > I'm attaching an application that reproduces the issue. > Requesting it like "http://localhost:8080/?ejb" will print tomee's naming tree > Requesting it like "http://localhost:8080" will print tomcat's naming tree -- This message was sent by Atlassian JIRA (v6.4.14#64029)