Hi, Since RC4 there is the JNDI ear prefixing which is very useful to prevent name clashes. But, when I try to call an EJB3 from within my JSF based WAR I have to do very crazy things to find out about the runtime name of the ear file. This because my ear file has a format like EARNAME-A_VERSION.ear. The A_VERSION is something I don't feel like hard coding into my JSF BB's, I need to find out about it at runtime. Isn't there something like an EAR local JNDI tree which all WARs within the same EAR can use to find their EAR local stuff? I already tried via 'java:comp', but this is not populated with the EJB3 beans at all.
BTW: the runtime full EAR name detection code looks like (anyone, please, how do I avoid such f*cking things): private static final String EAR_PREFIX = "myapplication-deploy"; private T getEJB3(Class clazz) { try { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); String fullEARPrefix = ""; if (classLoader instanceof URLClassLoader) { URLClassLoader urlClassLoader = (URLClassLoader) classLoader; URL[] urls = urlClassLoader.getURLs(); for (URL url : urls) { String path = url.getPath(); if (path.matches(".*" + EAR_PREFIX + ".*\\.ear.*")) { fullEARPrefix = path.substring( path.indexOf(EAR_PREFIX), path.indexOf(".ear")); break; } } } LOG.debug("full EAR prefix: " + fullEARPrefix); InitialContext initialContext = new InitialContext(); T instance = (T) initialContext.lookup(fullEARPrefix + clazz.getSimpleName() + "/local"); return instance; } catch (NamingException e) { throw new RuntimeException("naming error: " + e.getMessage(), e); } } View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3922055#3922055 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3922055 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user