如何在部署后更新WAS Liberty中的配置文件可以不像Tomcat Web服务器吗?

问题描述 投票:1回答:3

在WAS Liberty容器中部署WAR文件后,我尝试通过停止并再次重新启动WAS liberty服务器来编辑“WEB-INF”文件夹下的一个配置文件。但是,我无法使用更新的信息,它使用初始部署期间使用的旧配置。

websphere-liberty
3个回答
2
投票

如果你放.war,它会在每次服务器启动时自动扩展。但是,您也可以使用“扩展部署”并将解压缩的.war放到apps文件夹中。在这种情况下,您将能够在重新启动期间动态修改文件而无需重写。查看此link了解更多详情。


0
投票

继续这个问题...并感谢您对此问题的回复。我正在寻找解决方案,它将自动解压缩WAR文件,如tomcat,WAS等...我们可以在此WAR提取后更新和使用这些信息。

我检查了autoexpand选项并将其设为false。现在进行此更改后,WAR文件未在apps文件夹中解压缩。

实际上,我们可以使用此解决方案作为解决方法,即需要在server.xml中启用自动扩展选项。这将扩展/提取WAR文件。然后需要停止Liberty服务器。现在,更新server.xml并禁用自动扩展选项。之后,我们需要更新所需的配置文件。然后需要启动服务器。这实际上有效,但这不能解决。

我正在寻找像tomcat web服务器这样的解决方案,在部署war文件之后,我们可以在webapps / xx / WEB-INF / path中进行更改以进行进一步的配置设置。


0
投票

谢谢您的回复!!

请查看要求详情。

部署WAR文件@ / opt / Liberty / wlp / usr / servers / TCLiberty / apps /

-rw-r - r-- 1 clsqa cls 43358874 Apr 5 17:21 TC-DEV-4.3.war

此文件将被解压缩@ / opt / Liberty / wlp / usr / servers / TCLiberty / apps / expanded /

/选择/自由/ WLP的/ usr /服务器/ TCLiberty /应用/扩展> LS

drwxr-x --- 10 clsqa cls 4096 Apr 11 14:53 TC-DEV-4.3.war

/ opt / Liberty / wlp / usr / servers / TCLiberty / apps / expanded> ls -ltr TC-DEV-4.3.war total 60 -rw-r ----- 1 clsqa cls 1555 Feb 28 01:53 index.html drwxr-x --- 3 clsqa cls 4096 Apr 11 14:53 .. drwxr-x --- 2 clsqa cls 4096 Apr 11 14:53 META-INF drwxr-x --- 9 clsqa cls 4096 Apr 11 14:53图片drwxr-x --- 2 clsqa cls 4096 Apr 11 14:53日志drwxr-x --- 8 clsqa cls 4096 Apr 11 14:53 WEB-INF drwxr-x --- 3 clsqa cls 4096 Apr 11 14:53 css drwxr-x --- 2 clsqa cls 12288 Apr 11 14:53 html drwxr-x --- 10 clsqa cls 4096 Apr 11 14:53。 drwxr-x --- 2 clsqa cls 12288 Apr 11 14:53 js drwxr-x --- 2 clsqa cls 4096 Apr 11 14:53 pdf

The WAR file extraction was done automatically since we have made auto expand = true

<!-- Enable features -->
<featureManager>
    <feature>webProfile-8.0</feature>
</featureManager>

<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
              httpPort="9080"
              httpsPort="9443"
              host="*" />

<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<webApplication contextRoot="TC-DEV-4.3" location="TC-DEV-4.3.war" />
<mimeTypes>
<type>.htc=text/x-component</type>
</mimeTypes>

现在我的要求是对“/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded/TC-DEV-4.3.war/WEB-INF/”中提供的文件进行更改。

/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded/TC-DEV-4.3.war/WEB-INF>ls TMS.properties -rw-r ----- 1 clsqa cls 2789 Apr 2 2010 TMS的.properties

Content of this file are some predefined variables (constants)and ip address(variable) of the application and corresponding port. This IP address is always different which need to modified depending upon the application server and ports of the environment

appaddrlist=//:

为了更改此文件,我需要停止Liberty服务器。但是当我再次重新启动服务器时,将在“扩展”路径中提取现有的WAR文件。我失去了我的变化。

现在,根据我们提供的讨论和解决方案,我可以创建server.xml文件并将autoexpand选项更改为false。在这种情况下,TMS.property文件不会被覆盖,我的问题得到解决。

但是,我相信这个解决方案是解决方法,因为每次我都需要修改server.xml文件。

还有其他解决方案吗?之前我已经提到了tomcat web服务器的参考,我们可以在tomcat服务器自动提取后在WEB-INF文件夹中进行更改。

要求在这方面提供指导。

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.