2012-01-31 125 views
1

我安装了一个名为HelloWorld的应用程序,但尚未部署。它的状态是Installed,像这样的:使用wlfullclient.jar部署已安装的WebLogic 10.3.4应用程序

enter image description here

当我试图将其部署到目标服务器上,说AdminServer,它导致创建一个名为其部署在AdminServerhelloworld.war新的应用程序而原来的HelloWorld应用仍处于Installed状态。应用helloworld.war是一个处于状态Active ...快照:

enter image description here

这是我用来部署已安装的应用程序的代码:

File warFilePath = new File("c:/helloworld.war"); // war file path on AdminServer machine 

Target adminServerTarget = deployManager.getTarget("AdminServer"); 
WebLogicTargetModuleID targetModuleID = deployManager.createTargetModuleID(
     "HelloWorld", ModuleType.WAR, adminServerTarget); 
WebLogicTargetModuleID[] targetModuleIDs = new WebLogicTargetModuleID[1]; 
targetModuleIDs[0] = targetModuleID; 

ProgressObject redeployProcessObject = 
    deployManager.redeploy(targetModuleIDs, warFilePath, null /*no deployment plan*/); 

有两个令人吃惊的事实,虽然。

首先,在WebLogic版本9.x上运行此代码到10.3。 它工作得很好。

其次,从WLST提示符运行此代码时,使用jython它甚至在10.3版本上也可以很好地工作。 (我可以附加确切的命令,虽然他们是相同的Java除了语法收养)...

我的问题是,我怎么让它也在10.3.4上工作?

回答

0

我应该以为没有人会回答这个问题...... :)

无论如何,我找到了解决办法。我应该用deploy代替redeploy,用DeploymentOptions它的名字是对现有应用程序的名称(HelloWorld):

 ProgressObject redeployProcessObject = null; 
     try { 
      final DeploymentOptions options = new DeploymentOptions(); 
      options.setName(applicationName); 
      redeployProcessObject = deployManager.deploy(
       targetModuleIDs, warFilePath, null /*no deployment plan*/, options); 
     } catch (TargetException e) { 
      final String message = 
        String.format("Deployment of application %s on target %s failed: %s", 
          applicationName, allTargets, e.getMessage()); 
      _log.error(message, e); 
     } 

按照docsredeploy只替换当前的应用程序文件,并计划用一个更新的版本。而deploy将文件(从AdminServer)分发到目标并启动应用程序。另外,在深入研究WebLogic的jython脚本和jar之后,我发现这正是在WLST中调用redeploy时完成的工作。

相关问题