linux weblogic java_options_使用Linux脚本更新Weblogic部署的应用程序

在利用Jenkins实现Weblogic应用自动部署的功能时,如何通过Shell 脚本自动更新Weblogic部署的应用程序呢?

可以使用weblogic.jar包中的weblogic.Deployer这个class 。

命令如下:

java weblogic.Deployer -adminurl t3://192.168.142.136:47001 -user weblogic -password weblogic123 -name session -targets sysmanm -redeploy

其中t3://192.168.142.136:7001 是我管理服务(即AdminServer)的的IP地址和端口,weblogic是我登录weblogic控制台的用户名,weblogic123是密码 , session是部署的应用名称,sysmanm 是托管服务名,我的session应用就部署在这个服务上。

另在使用命令之前,可以shell脚本中加上weblogic的环境变量,否则可能报找不到CLASS的错误。

完成的sysmanm_redeploy.sh脚本如下:export CLASSPATH=/usr/java/1.8.0_111/lib/tools.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/server/lib/weblogic_sp.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/server/lib/weblogic.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/server/lib/webservices.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/../oracle_common/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/home/hadoop/Oracle/Middleware/Oracle_Home/wlserver/modules/features/oracle.wls.common.nodemanager_1.0.0.0.jar:.:/usr/java/1.8.0_111/lib/dt.jar:/usr/java/1.8.0_111/lib/tools.jar

#java weblogic.WLST testWeblogicStart.py $1 $2 $3 $4 $5

java weblogic.Deployer -adminurl t3://192.168.142.136:7001 -user weblogic -password weblogic123 -name session -targets sysmanm -redeploy

使用sh sysmanm_redeploy.sh执行脚本

[hadoop@localhost shell]$ sh sysmanm_redeploy.sh

weblogic.Deployer invoked with options: -adminurl t3://192.168.142.136:7001 -user weblogic -name session -targets sysmanm -redeploy

Task 4 initiated: [Deployer:149026]redeploy application session on sysmanm.

Task 4 completed: [Deployer:149026]redeploy application session on sysmanm.

Target state: redeploy completed on Server sysmanm

如下是我本地weblogic服务的简单配置,大家可以参考:

6f84ac5e3f5f9f79b07b0520131d7867.png

cadfc93a9082ad5367489a7b4960d0b2.png

df4a811bd436ae3579c523683aad8037.png

附上weblogic.Deployer的帮助信息,如下:

Usage: java weblogic.Deployer [options] [action] [Deployment units(s)]

where options include:

-help Print the standard usage message.

-version Print version information.

-adminurl <://:> [option] Administration

server URL: default t3://localhost:7001

-username [option] user name

-password [option] password for the user

-userconfigfile [option] The user config file

contains the user security credentials; it

is administered by the weblogic.Admin tool

-userkeyfile [option] The users key file; it is

administered by the weblogic.Admin tool.

-distribute [action] Distribute application to the

targets.

-start [action] Makes an already distributed

application available on a target.

-stop [action] Makes an application unavailable on

targets.

-redeploy [action] Replace a running application

partially or entirely.

-undeploy [action] Take an application out of service.

-deploy [action] Make an application available for

service.

-update [action] Update an application configuration

in place.

-examples [option] Displays example usage of this tool.

-name [option] Defaults to the basename of the

deployment file or directory.

-targets <> [option] A comma separated list of targets

for the current operation. If not specified,

all configured targets are used. For a new

application, the default target is the

administration server.

-plan [option] Specifies location of

deployment plan

-library [option] Indicates that the unit being

deployed is a library. This option is

required when the application is a library.

-advanced Print advanced usage options.

The optional trailing arguments are deployment units and may

represent the archive being deployed, the name of a previously

deployed application or a list of files for a partial redeploy operation.

更多信息请参考:http://docs.oracle.com/middleware/1213/wls/wls-developdeploy.htm

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值