如何从 Weblogic 中删除不同步、已删除的自动部署应用程序

How to remove out-of-sync, deleted autodeployed apps from Weblogic

作为 Weblogic 的新手,我按照一些自述文件将应用程序部署到 Weblogic,方法是将 war 文件复制到 autodeploy 文件夹。它们会自动显示在 Weblogic 控制台中,目前一切顺利。

后来,我从 autodeploy 文件夹中删除了其中一些应用程序,希望它们也从“部署”页面中消失。令我惊讶的是,一旦我启动服务器,它们仍然存在,而且我也无法删除它们:Weblogic 说我需要从自动部署文件夹 (!) 中删除 wars。

当然,我应该先阅读文档,其中说明如下:

Auto-Deploying, Redeploying, and Undeploying Archived Applications

To auto-deploy an archived application, copy its archive file to the /autodeploy directory. WebLogic Server automatically sets the application’s deployment mode to stage mode.

A deployment unit that was auto-deployed can be dynamically redeployed while the server is running. To dynamically redeploy, copy the new version of the archive file over the existing file in the /autodeploy directory.

To undeploy an archived deployment unit that was auto-deployed, delete the application from the /autodeploy directory. WebLogic Server stops the application and removes it from the configuration. Note: If you delete an application from the /autodeploy directory when the server is not active, WebLogic Server will not detect that the application was deleted even when the server is again in an active state. In order to prevent an out-of-sync domain tree, BEA recommends that you only remove applications from the /autodeploy directory when the server is in an active state.

由于我在服务器宕机时删除了文件,它们仍然显示在那里。这个特定文档中没有的是一旦它不同步时如何修复它。

答案很简单。

  1. 使用文件管理器(Windows Explorer 或 Nautilus,例如)导航到 Weblogic 的域文件夹。

  2. 打开config文件夹中的config.xml文件;

  3. 找到您在 <app-deployment> 标签之间删除的应用程序。

  4. 将它们从 xml 文件中删除;

  5. 重新启动服务器。