使用 wlfullclient.jar 在 WebLogic 10.3.4 上部署已安装的应用程序
我安装了一个名为 HelloWorld
的应用程序,但尚未部署。它的状态是 Installed
,如下所示:
当我尝试部署时它在目标服务器上,例如 AdminServer
,它会创建一个名为 helloworld.war
的新应用程序,该应用程序部署在 AdminServer
而原来的HelloWorld
应用程序保持在 Installed
状态。应用 helloworld.war
是处于状态 Active
的应用...快照:
这是我用来部署已安装的应用程序的代码:
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.3 上运行此代码时,它运行良好。
其次,当从 WLST 提示符运行此代码时,使用 jython 即使在版本 10.3.4 上它也能很好地工作(我可以附加确切的命令,尽管它们与java 除了语法采用之外)...
我的问题是,如何使其在 10.3.4 上也能工作?
I have an application named HelloWorld
installed, yet not deployed. Its state is Installed
, like such:
When I'm trying to deploy it on target server, say AdminServer
, it results in creating a new application named helloworld.war
which is deployed on AdminServer
whereas the original HelloWorld
app remains in Installed
state. App helloworld.war
is the one that is in state Active
... Snapshot:
Here's the code I use to deploy the already installed app:
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*/ );
There are two surprising facts, though.
First, when running this code on WebLogic versions 9.x to 10.3.3 it works great.
Second, when running this code from WLST prompt, with jython it also works great even on version 10.3.4 (I can attach the exact commands although they're the same as java except for syntactic adoptions)...
My question is, how do I make it work also on 10.3.4?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我应该以为没有人会回答这个问题...:)
无论如何,我找到了解决方案。我应该使用
deploy
而不是redeploy
,并使用DeploymentOptions
,其名称是现有应用程序名称(HelloWorld
):根据文档,
redeploy
仅用更新版本替换当前应用程序文件和计划。而deploy
将文件(从 AdminServer)分发到目标并启动应用程序。另外,在深入研究 WebLogic 的 jython 脚本和 jar 后,我发现这正是在 WLST 中调用
redeploy
时所做的事情。I should have thought that no one would answer this question... :)
Anyway, I found a solution. I should have used
deploy
instead ofredeploy
, with aDeploymentOptions
of which name is the existing application name (HelloWorld
):According to the docs,
redeploy
only replaces the current application files and plan with an updated version. Whereasdeploy
distributes the files (from the AdminServer) to the target(s) and starts the application.Also, after digging deep in WebLogic's jython scripts and jars I found out that this is exactly what's done when invoking
redeploy
in the WLST.