我听说我可以使用dropins目录来热部署代码。但是,假设我要使用apps目录和预配置的应用程序。例如,我下载了标准的liberty jar版本16。并使用server.config目录下的“ apps”目录,可以将EAR添加到该目录。另外,我在server.xml中添加了以下配置:
基于此,我使用的是一个类加载的目录和一个enterpriseApplication条目,在启动和停止服务器时将加载此配置,但是我不知道如何确保此配置用于热部署。例如。当我换耳朵时,我希望服务器将自动重新启动和/或重新加载类。
我希望有一个“扫描”属性为enterpriseApplication。
我使用了“ applicationMonitor”设置,但无法识别我的enterpiseApplication目录,因此未加载。该配置似乎只能识别dropins。
我尝试使用dropins,但由于使用共享库而无法使用。我不能将所有罐子放在一个EAR中。
<library id="Alexandria">
<fileset dir="/usr/local/pfs/dist/wlp/usr/servers/rest/mylib/Alexandria" includes="*.jar" scanInterval="20s" />
</library>
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<enterpriseApplication location="napolEA.ear" name="MyApp">
<classloader privateLibraryRef="Alexandria" />
</enterpriseApplication>
最佳答案
使用Liberty进行“热部署”代码的最简单方法是使用WebSphere Developer Tools(WDT)eclipse插件:https://developer.ibm.com/wasdev/downloads/liberty-profile-beta/
关于应用程序的“扫描”属性:任何<application>
,<webApplication>
或<enterpriseApplication>
扫描都由<applicationMonitor>
元素控制。默认情况下,它的配置是:
<applicationMonitor updateTrigger="polled" pollingRate="500ms"/>
因此,配置应每500毫秒扫描一次应用更新。