The default jndi context in JBoss 5.1 for an EJB is "earname/ejbname/local". In some instances where injection is not available I need to manually do a jndi lookup, however if my ejb jar file is packaged in different EAR's I'd like to have a portable way to maintain a look up helper class.
I know a method to do this exists as I've seen it before but can't find it now. I'd like to programmatically find the current application name or ear name.
Any ideas?
Found through trial & error for jboss 6.1:
InitialContext ic = new InitialContext();
String moduleName = (String) ic.lookup("java:module/ModuleName");
String appName = (String) ic.lookup("java:app/AppName");
I know a method to do this exists as I've seen it before but can't find it now. I'd like to programmatically find the current application name or ear name.
I'm not aware of any obvious way to do that (not saying it's impossible, although I think the application name or ear name are more a "deployer" role concern) and my suggestion would be to either:
jboss.xml
~or~If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With