Search code examples
webspherewebsphere-8application-server

Websphere Console 9.0 - where to specify Application specific files paths in websphere console


Websphere version 9.0 is installed in our RHEL 8.3 OS . Now in that i have deployed one web app - .war file which contains multiple modules - webservice, web module etc. This war is successfully deployed and i am able to start it also going to Websphere Enterprise Applications - AppName - START. The app gets started with a success message.

Now the problem lies ahead. Our application requires a certain file bootstrap.properties. This file has several configurations like jdbc params, jmx ports, jms configurations, jvm arguments, logging paths etc.

Once the web module of this app is run on <SERVER_IP>:9080/Context url, it throws error on GUI saying Unable to locate bootstrap.properties.

Analysing at the code level , found out that below code is throwing this error:

    private static Properties config;
private static final String CONFIG_ROOT = System.getProperty("bootstrap.system.propertiespath");
private static final String configFile = "bootstrap.properties";

private JMXConfig() {
}

public static String getConfigRoot() {
    if (CONFIG_ROOT == null) {
        System.err.println("Not able to locate bootstrap.properties.  Please configure bootstrap.system.propertiespath property.");
        throw new ConfigException("Unable to locate bootstrap.properties.");
    } else {
        return CONFIG_ROOT + File.separator;
    }
}

I wanted to know where can we specify the absolute paths in the websphere console where our property file can be read as a system argument once the application is loaded.


Solution

  • Since you're using System.getProperty() to read the property, it needs to be specified as a Java system property passed into the JVM. You can do that from the JVM config panel, adding it as either a custom property on the JVM or as a -D option in the server's generic JVM arguments.

    Custom property: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-custom-properties

    Generic JVM argument: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-settings (search for "Generic JVM arguments")

    Note that if you use a custom property, you would simply set the "name" field to "bootstrap.system.propertiespath" and the "value" to the path you need; if you use a generic JVM argument, you'd add an argument with the structure "-Dbootstrap.system.propertiespath=/path/to/file".