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 server
bean-name : This is the name of the bean for which you are doing the lookup
fully-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 while doing JNDI lookup but I need to get in at runtime in case if I wish to override the ear name(deployment file placed at JBoss/deployment folder) using Command Line Interface
How to use javax.naming.InitialContext or ServeltContext or javax.naming.Context, I tried placing some property file and using these context files but I couldn't retrieve the application ear file name
The remote client application needs to know the exact JNDI name. Of course, the application can use some kind of properties to be passed into the application to know the app name, module name etc... but that's up to the application and even in that case, the person who is triggering the application will have to know the app name, module name etc.. to be fed to the JNDI name.