weblogic 中重定向应用程序的问题

Problems with retargeting apps in weblogic

我在 weblogic 中部署了 2 个应用程序:

app1: target1, target2
app2: target3

为了将 target2 分配给 app2,我执行下一个 wlst 命令:

connect('user', 'password', 't3://admin-address:admin-port')
undeploy("app1", targets="target2")
disconnect()
readDomain('domain-dir')
assign("AppDeployment","app2","Target","target2")
updateDomain()
closedomain()

没有错误,但只有从 target2 卸载 app1 有效。有人可以帮忙吗?

最终的解决方案是:

connect('user', 'password', 't3://<admin_server>:<admin_port>')

# remove target from the first application
edit()
startEdit()
cd('/AppDeployments/app1')
set('Targets',jarray.array([ObjectName('com.bea:Name=target1,Type=Server')], ObjectName))
activate()
exit()

# add target to the second application
edit()
startEdit()
cd('/AppDeployments/app2')
set('Targets',jarray.array([ObjectName('com.bea:Name=target2,Type=Server'), ObjectName('com.bea:Name=target3,Type=Server')], ObjectName))
activate()
exit()