• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get application ear file name using Java code for JNDI lookup

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)

ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>
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 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

Please advice.

Thanks in Advance.

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be better to ask this in the JBoss forum, moving...
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic