How can we get the EJB module name dynamically for JNDI on EAP 7 we have looked into the post on stack overflow here to get the module name
- We don't want to override in ejb-jar.xml.
- We don't want to customise the module name in maven so it is fixed.
- Nor we looking are looping at looping as we are currently implemented
URL url = clazz.getResource("");
String [] strArray = url.getPath().split("/");
for (int i=0; i<strArray.length; i++){
if (strArray[i].contains(".jar")){
moduleName = strArray[i].substring(0, strArray[i].length() - 4);
break;
}
}
jndiName = "java:app/"+moduleName+"/"+clazz.getSimpleName()+"!"+clazz.getCanonicalName();
Is there a cleaner way
java:app/<module-name>/<bean-name>!<fully-qualified-bean-interface-name>