Author: rmannibucau Date: Mon Feb 18 18:33:10 2013 New Revision: 1447422 URL: http://svn.apache.org/r1447422 Log: if the app is root we can't use a sub jndi tree
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1447422&r1=1447421&r2=1447422&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original) +++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Mon Feb 18 18:33:10 2013 @@ -1517,9 +1517,6 @@ public class Assembler extends Assembler for (final String id : appInfo.resourceAliases) { final String name = OPENEJB_RESOURCE_JNDI_PREFIX + id; ContextualJndiReference.followReference.set(false); - if (globalContext instanceof IvmContext) { - IvmContext.class.cast(globalContext).ignoreCache(name); - } try { final Object object; try { @@ -1996,7 +1993,7 @@ public class Assembler extends Assembler for (final String alias : serviceInfo.aliases) { bindResource(alias, service); } - if (serviceInfo.originAppName != null) { + if (serviceInfo.originAppName != null && !serviceInfo.originAppName.isEmpty() && !"/".equals(serviceInfo.originAppName)) { final String baseJndiName = serviceInfo.id.substring(serviceInfo.originAppName.length() + 1); serviceInfo.aliases.add(baseJndiName); final ContextualJndiReference ref = new ContextualJndiReference(baseJndiName); @@ -2018,9 +2015,6 @@ public class Assembler extends Assembler Object existing = null; try { ContextualJndiReference.followReference.set(false); - if (jndiContext instanceof IvmContext) { - IvmContext.class.cast(jndiContext).ignoreCache(name); - } existing = jndiContext.lookup(name); } catch (final Exception ignored) { // no-op Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java?rev=1447422&r1=1447421&r2=1447422&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java (original) +++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java Mon Feb 18 18:33:10 2013 @@ -884,7 +884,13 @@ public class AutoConfig implements Dynam final Map<ResourceInfo, Resource> resourcesMap = new HashMap<ResourceInfo, Resource>(resources.size()); for (Resource resource : resources) { final String originalId = value(resource.getId()); - resource.setId(module.getModuleId() + "/" + replaceJavaAndSlash(originalId)); + final String modulePrefix = module.getModuleId() + "/"; + + if ("/".equals(modulePrefix)) { + resource.setId(replaceJavaAndSlash(originalId)); + } else { + resource.setId(modulePrefix + replaceJavaAndSlash(originalId)); + } resource.setJndi(value(resource.getJndi())); resource.getProperties().putAll(holds(resource.getProperties())); @@ -938,7 +944,9 @@ public class AutoConfig implements Dynam for (JndiConsumer consumer : jndiConsumers) { addResource(consumer, resourceRef); // for injections etc... - addResource(consumer, strictRef); // for lookups (without prefix) + if (!"/".equals(modulePrefix)) { + addResource(consumer, strictRef); // for lookups (without prefix) + } } resourceInfos.add(resourceInfo); Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java?rev=1447422&r1=1447421&r2=1447422&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java (original) +++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java Mon Feb 18 18:33:10 2013 @@ -152,7 +152,7 @@ public class IvmContext implements Conte } // don't cache proxies - if (!(obj instanceof IntraVmProxy)) { + if (!(obj instanceof IntraVmProxy) && !(obj instanceof ContextualJndiReference)) { fastCache.put(compoundName, obj); } } @@ -469,10 +469,6 @@ public class IvmContext implements Conte if (readOnly) throw new OperationNotSupportedException(); } - public void ignoreCache(final String name) { - fastCache.remove(name); - } - protected class MyBindingEnumeration extends MyNamingEnumeration { public MyBindingEnumeration(NameNode parentNode) {