This content has been marked as final.
Show 4 replies
-
1. Re: EJB3 RC5 & JNDI lookup in JSF WAR
bill.burke Feb 7, 2006 9:48 AM (in response to fcorneli)why don't you just define your own jndi mappings for the EJBs within jboss.xml or @Local/RemoteBinding?
-
2. Re: EJB3 RC5 & JNDI lookup in JSF WAR
fcorneli Feb 7, 2006 9:56 AM (in response to fcorneli)"bill.burke@jboss.com" wrote:
why don't you just define your own jndi mappings for the EJBs within jboss.xml or @Local/RemoteBinding?
If I use @Local/RemoteBinding I lose the EAR prefix behaviour. I need to keep the EAR prefix because I have to deploy the same application multiple times, each time with a different EAR filename. Thus I need the EAR prefixes to scope my applications, but I don't want to have the prefix all over my WAR servlets. It should (IMHO) be possible to do an 'EAR scoped JNDI lookup' without too much pain.
Frank. -
3. Re: EJB3 RC5 & JNDI lookup in JSF WAR
bill.burke Feb 7, 2006 10:04 AM (in response to fcorneli)Ok, I think this is something we could do. Let me move this thread to EJB3 Design to see if it is something we *want* to do.
-
4. Re: EJB3 RC5 & JNDI lookup in JSF WAR
fcorneli Feb 8, 2006 9:06 AM (in response to fcorneli)It's getting even better. In case you're in a SAR, you have to do something like:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader instanceof UnifiedClassLoader) { UnifiedClassLoader unifiedClassLoader = (UnifiedClassLoader) classLoader; URL url = unifiedClassLoader.getURL(); String path = url.getPath(); if (path.matches(".*" + EAR_PREFIX + ".*\\.ear.*")) { String fullEARPrefix = path.substring(path.indexOf(EAR_PREFIX), path .indexOf(".ear")); return fullEARPrefix; } }