Websphere Console 9.0—在Websphere Console中指定特定于应用程序的文件路径的位置

Websphere Console 9.0—在Websphere Console中指定特定于应用程序的文件路径的位置,websphere,websphere-8,application-server,Websphere,Websphere 8,Application Server,Websphere 9.0版安装在我们的RHEL 8.3操作系统中。 现在,我已经部署了一个web应用程序-.war文件,其中包含多个模块-webservice、web模块等。 这场战争已经成功部署,我也能够在Websphere Enterprise Applications-AppName-start中启动它。 应用程序启动时会显示一条成功消息 现在问题就在前面。我们的应用程序需要一个特定的文件bootstrap.properties。 该文件有几个配置,如jdbc参数、jmx端口、jms配置

Websphere 9.0版安装在我们的RHEL 8.3操作系统中。 现在,我已经部署了一个web应用程序-.war文件,其中包含多个模块-webservice、web模块等。 这场战争已经成功部署,我也能够在Websphere Enterprise Applications-AppName-start中启动它。 应用程序启动时会显示一条成功消息

现在问题就在前面。我们的应用程序需要一个特定的文件
bootstrap.properties
。 该文件有几个配置,如jdbc参数、jmx端口、jms配置、jvm参数、日志路径等

一旦此应用程序的web模块在
:9080/Context
url上运行,它就会在GUI上抛出错误,表示
无法找到bootstrap.properties

在代码级别进行分析,发现以下代码引发了此错误:

    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;
    }
}

我想知道,在websphere控制台中,在哪里可以指定绝对路径,一旦加载应用程序,我们的属性文件就可以作为系统参数读取。

因为您使用system.getProperty()读取属性,所以需要将其指定为传递到JVM中的Java系统属性。您可以从JVM配置面板执行此操作,将其添加为JVM上的自定义属性或服务器的通用JVM参数中的-D选项

自定义属性:

通用JVM参数:(搜索“通用JVM参数”)


请注意,如果使用自定义属性,只需将“name”字段设置为“bootstrap.system.propertiespath”,并将“value”设置为所需的路径;如果您使用通用JVM参数,您将添加一个结构为“-Dbootstrap.system.propertiespath=/path/to/file”的参数。

谢谢@Jarid。。。这在使用“自定义属性”解决方案时起作用。