How to access application.xml file of an EAR deployed to IBM WebSphere 6.1

user124626 picture user124626 · Jan 11, 2010 · Viewed 7.5k times · Source

I am deploying an EAR file to the IBM WebSpehre server 6.1 - I want to be able to access the EAR application name which is stored in the deployment file under 'display-name'. Looking through stack overflow posts on related subjects, I've been able to gather that this is possible via the Java MBean API - or IBM's WAS API - Problem is I cannot find a place where these API lists are summarized, i.e. cannot figure out which one to begin looking at. I could hardcode the WAS install location and find the file by looking in the 'installedApps' directory, but this is not dynamic.

Does anyone have any experience working with these APIs? Any other way to dynamically find the deployed EAR's display name?

EDIT - I should add that the reason I would like this information is to dynamically load our properties files - that are named by the following convention "EARAppName.properties" - so you see there IS a reasonable 'rationale' behind desiring this information in my application

EDIT 2 - I should also note that this app will always be deployed on a WAS - but in the case that it isnt, a generic non-proprietary solution would be preferred, but not necessary at this moment.

EDIT 3 - What I want to accomplish: Is there a way to dynamically find the deployed EAR's display name from within the application code?

Answer

Pascal Thivent picture Pascal Thivent · Feb 15, 2010

Not a direct answer but wouldn't it be simpler to use an hard coded name for the properties file? After all, it seems to make sense for a given application to be aware of what file to load. Writing code to read the display-name in a deployment descriptor sounds odd (especially since you, as Application Component Provider, shouldn't rely on something owned by the Application Assembler).