I'm not sure if I get your requirements.
If you use the CLI to deploy the application you can set the application names as you want.
In a client you need to know the 'application URL' for http or rmi.
I have migrated an EAR application from Jboss 3 to JBoss 7. For JNDI lookups I am using the following syntax in JBoss AS 7.1 (as referred in https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI)
>where ->app-name : This is the name of the .ear (without the .ear suffix)module-name : This is the name of the .jar (without the .jar suffix)distinct-name : This is a JBoss AS7 specific name which can be optionally assigned to the deployments that are deployed on the serverbean-name : This is the name of the bean for which you are doing the lookupfully-qualified-classname-of-the-remote-interface : This is the fully qualified class name of the interface for which you are doing the lookup.
As of now I am hardcoding the app-name,module-name etc.
But instead I need to use the app-name which ever supplied at run time (as like you mentioned in CLI) in the code dynamically instead of hardcoidng.
Is there anyway I can do this, It seems I can make use of property file to retrieve from environment variable or javax.naming.Context as referred in some some forums.
I tried but no luck.