@@ -904,11 +904,12 @@ private void storeAppScopedResources(Map<String, List<String>> resources, String
904904 appNamespace .addAll (appLevelResources );
905905 for (Map .Entry <String , List <String >> entry : resources .entrySet ()) {
906906 if (!entry .getKey ().equals (appName )) {
907- List <String > jndiNames = moduleNamespaces .get (entry .getKey ());
907+ String moduleName = getActualModuleName (entry .getKey ());
908+ List <String > jndiNames = moduleNamespaces .get (moduleName );
908909 if (jndiNames == null ) {
909910 jndiNames = new ArrayList <>();
910911 jndiNames .addAll (entry .getValue ());
911- moduleNamespaces .put (entry . getKey () , jndiNames );
912+ moduleNamespaces .put (moduleName , jndiNames );
912913 }
913914 else {
914915 jndiNames .addAll (entry .getValue ());
@@ -934,7 +935,7 @@ public void store(String jndiName, JndiNameEnvironment env) {
934935 }
935936 }
936937 else if (jndiName .startsWith (ResourceConstants .JAVA_MODULE_SCOPE_PREFIX )) {
937- String moduleName = DOLUtils .getModuleName (env );
938+ String moduleName = getActualModuleName ( DOLUtils .getModuleName (env ) );
938939 List <String > jndiNames = moduleNamespaces .get (moduleName );
939940 if (jndiNames == null ) {
940941 jndiNames = new ArrayList <>();
@@ -970,7 +971,7 @@ public boolean find(String jndiName, JndiNameEnvironment env) {
970971 return jndiNames != null && jndiNames .contains (jndiName );
971972 }
972973 else if (jndiName .startsWith (ResourceConstants .JAVA_MODULE_SCOPE_PREFIX )) {
973- String moduleName = DOLUtils .getModuleName (env );
974+ String moduleName = getActualModuleName ( DOLUtils .getModuleName (env ) );
974975 List jndiNames = moduleNamespaces .get (moduleName );
975976 return jndiNames != null && jndiNames .contains (jndiName );
976977 }
@@ -981,6 +982,18 @@ else if (jndiName.startsWith(ResourceConstants.JAVA_GLOBAL_SCOPE_PREFIX))
981982 else
982983 return nonPortableJndiNames .contains (jndiName );
983984 }
985+
986+ /**
987+ * Remove suffix from the module name.
988+ */
989+ private String getActualModuleName (String moduleName ) {
990+ if (moduleName != null ){
991+ if (moduleName .endsWith (".jar" ) || moduleName .endsWith (".war" ) || moduleName .endsWith (".rar" )){
992+ moduleName = moduleName .substring (0 , moduleName .length ()-4 );
993+ }
994+ }
995+ return moduleName ;
996+ }
984997 }
985998
986999 /**
0 commit comments