Programmatically defining a JNDI root context / ear name in JBoss 5.1

By default, the jndi context in JBoss 5.1 for EJB is "earned / ejbname / local". In some cases when the injection is not available, I need to manually search in jndi, however, if my jjj jjj file is packaged in different EARs, I would like to have a portable way to support the helper class.

I know that a method exists for this, since I have seen it before, but I cannot find it now. I would like to programmatically find the current application name or ear name.

Any ideas?

+5
source share
2 answers

Found through trial version and 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");
+6

, , , . .

- ( , , , "" ), :

  • JNDI , jboss.xml ~ ~
  • ( )

.

+1

All Articles