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

时间:2019-04-04 09:44:51

标签: websphere-liberty

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

3 个答案:

答案 0 :(得分:2)

如果放置.war,则每次服务器启动时它将自动展开。但是,您也可以使用“扩展部署”并将解压的.war放入apps文件夹。在这种情况下,您将能够即时修改文件,而无需在重新启动期间进行重写。检查此link以获得更多详细信息。

答案 1 :(得分:0)

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

我检查了autoexpand选项并将其设置为false。现在,进行更改后,不会在apps文件夹中提取WAR文件。

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

我正在寻找类似tomcat Web服务器的解决方案,在其中部署war文件之后,我们可以在webapps / xx / WEB-INF /路径内进行更​​改以进行进一步的配置设置。

答案 2 :(得分:0)

谢谢您的回复!

请找到要求的详细信息。

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

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

此文件将在@ / opt / Liberty / wlp / usr / servers / TCLiberty / apps / expanded /

中解压缩

/ opt / Liberty / wlp / usr / servers / TCLiberty / apps / expanded> 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 总共60 -rw-r ----- 1 clsqa cls 1555 2月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

WAR文件提取是自动完成的,因为我们已经将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 2010年4月2日TMS.properties

此文件的内容是应用程序和相应端口的一些预定义变量(常量)和ip地址(变量)。此IP地址始终不同,需要根据应用服务器和环境端口进行修改

appaddrlist = //:

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

现在,按照我们提供的讨论和解决方案,我可以制作server.xml文件并将autoexpand选项更改为false。在这种情况下,TMS.property文件不会被覆盖,并且我的问题已解决。

但是,我认为此解决方案是解决方法,因为每次需要修改server.xml文件时。

还有其他解决方案吗?早些时候,我给出了tomcat Web服务器的参考,在该服务器中,我们可以在tomcat服务器自动提取后在WEB-INF文件夹中进行更改。

在这方面要求提供指导。

谢谢

相关问题