Thank you Brian!
But in this case these properties are useless for me,
Also the the deployment.xsd is not helpful if I have to place it untder this directory path, which is deployment dependent.
I saw that the following class loader property is defined in this file:
<classloader xmi:id="Classloader_1649780608092" mode="PARENT_LAST"/>
Is there a way to define this property in a "standard" WebSphere deployment descriptor (e.g. ibm-application-bnd.xml)? It is rather annoying to set this property every time after the deployment manually.
Kind regards
Thomas
------------------------------
Thomas Mayr
------------------------------
Original Message:
Sent: Wed April 13, 2022 12:53 PM
From: Brian S Paskin
Subject: Access Custom Properties of a Web Application from Code
Ok, I did some more digging. Those properties are used during deploy time/startup, but not at runtime, which makes them not useable for the application. The appdeployment XSD does not look like it is available as a single XSD, but part of application.xsl.
Brian
------------------------------
Brian S Paskin
Sr. Cloud Engineer
IBM Cloud Engineering
Original Message:
Sent: Wed April 13, 2022 09:20 AM
From: Thomas Mayr
Subject: Access Custom Properties of a Web Application from Code
Hello Brian,
sorry, but this doesn't work! I defined the property "OpenAMBaseURL" here:
I also wonder where (in which folder) I should add the deployment.xml to the EAR. I downloaded the EAR from Websphere and found this file in META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp. Is this the right path? Further I wonder if I have to specify all these XML entries in this file. Are the all mandatory? Is there a documentation (XSD) of this XML structure? I'd like to understand what I'm doing.
Kind regards
Thomas
------------------------------
Thomas Mayr
Original Message:
Sent: Wed April 13, 2022 05:45 AM
From: Brian S Paskin
Subject: Access Custom Properties of a Web Application from Code
Hi, App custom properties act like any other System property and can be retrieved in the application the same way, System.getProperty("propertyName"); .
If you are using the Eclipse tooling then you should be able to add the property to the deployment.xml. Example of my deployment.xml where I have "my.hair.colour":
<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1648758360938">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1648758360938" deploymentId="0" startingWeight="1" binariesURL="$(APP_INSTALL_ROOT)/paskinoCell/modresorts-1_0_war.ear" useMetadataFromBinaries="false" enableDistribution="true" createMBeansForResources="true" reloadEnabled="false" appContextIDForSecurity="href:paskinoCell/modresorts-1_0_war" filePermission=".*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755" allowDispatchRemoteInclude="false" allowServiceRemoteInclude="false" asyncRequestDispatchType="DISABLED" standaloneModule="true" enableClientModule="false">
<targetMappings xmi:id="DeploymentTargetMapping_1648758360938" enable="true" target="ServerTarget_1648758360938"/>
<classloader xmi:id="Classloader_1648758360938" mode="PARENT_FIRST"/>
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1648758360938" deploymentId="1" startingWeight="10000" uri="modresorts-1.0.war" containsEJBContent="0">
<targetMappings xmi:id="DeploymentTargetMapping_1648758360939" target="ServerTarget_1648758360938"/>
<classloader xmi:id="Classloader_1648758360939"/>
</modules>
<properties xmi:id="Property_1648758360938" name="metadata.complete" value="false"/>
<properties xmi:id="Property_1649842716335" name="my.hair.colour" value="bald" required="false"/>
</deployedObject>
<deploymentTargets xmi:type="appdeployment:ServerTarget" xmi:id="ServerTarget_1648758360938" name="server1" nodeName="paskinoNode"/>
</appdeployment:Deployment>
------------------------------
Brian S Paskin
Sr. Cloud Engineer
IBM Cloud Engineering
Original Message:
Sent: Tue April 12, 2022 05:35 AM
From: Thomas Mayr
Subject: Access Custom Properties of a Web Application from Code
Hello IBM Folks,
it is possible to define custom application propertes in the WebSphere console under Enterprise Applications > MyApplication > Custom properties. Now the following questions arise:
- How can I access these properties from the application code?
- Is it possible to pre-define these properites in a deployment descriptor with default values?
Kind regards
Thomas
------------------------------
Thomas Mayr
------------------------------