如何启动或停止部署在 weblogic 上的应用程序

如何启动或停止部署在 weblogic 上的应用程序

我想暂时停止部署在 weblogic 上的应用程序,这意味着我应该能够立即启动该应用程序而无需部署在 weblogic 上。

答案1

我们可以通过使用 weblogic mbeans 来实现这一点。请参阅下面的代码以供参考。

appRuntime.停止();

appRuntime.启动();

    @Override
public void stop(String deploymentName)
{
    System.out.println("*** Stopping webapp...");

    // The DeploymentManagerMBean is used for the initial deployment of an application.
    // After the initial deployment, the AppDeploymentRuntimeMBean is used for stop, start,
    // redeploy, and undeploy of an application.

    AppDeploymentRuntimeMBean appRuntime = deploymentManager.lookupAppDeploymentRuntime(deploymentName);

    DeploymentProgressObjectMBean progressObj = appRuntime.stop();
    printCompletionStatus(progressObj);
}

@Override
public void start(String deploymentName)
{
    System.out.println("*** Starting webapp...");

    // The DeploymentManagerMBean is used for the initial deployment of an application.
    // After the initial deployment, the AppDeploymentRuntimeMBean is used for stop, start,
    // redeploy, and undeploy of an application.

    AppDeploymentRuntimeMBean appRuntime = deploymentManager.lookupAppDeploymentRuntime(deploymentName);

    DeploymentProgressObjectMBean progressObj = appRuntime.start();
    printCompletionStatus(progressObj);
}

访问 appRuntime 时,我们需要传递部署名称作为参数

相关内容