使用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
<Nov 24, 2016 11:50:31 AM CST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, session [archive: null], to sysmanm .>
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服务的简单配置,大家可以参考:
附上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 <<protocol>://<server>:<port>> [option] Administration
server URL: default t3://localhost:7001
-username <username> [option] user name
-password <password> [option] password for the user
-userconfigfile <userconfigfile> [option] The user config file
contains the user security credentials; it
is administered by the weblogic.Admin tool
-userkeyfile <keyConfigFile> [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 <application name> [option] Defaults to the basename of the
deployment file or directory.
-targets <<target(s)>> [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 <Deployment plan path> [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
使用Linux脚本更新Weblogic部署的应用程序的更多相关文章
- ClickOnce部署疑难杂症:更新时部署与应用程序标识不一致问题。要安装此应用程序,请修改此文件的清单版本或卸载之前存在的应用程序。
使用ClickOnce部署winform应用程序.无论是安装或者自动更新都极为方便,但有时候一些疑难杂症也令人头疼 1.注意每次部署完成之后 setup.exe无需覆盖,只需要在Application ...
- Linux环境下执行脚本重启Weblogic控制台中部署的应用程序
之前有写过一篇博文介绍切换登录方式的脚本,脚本中存在一个缺点:仍需手动去Weblogic控制台重启应用程序:本文即介绍如何在脚本中更新Weblogic控制台中部署的应用程序. 一.配置Weblogic ...
- linux下实现自动部署tomcat的脚本
linux下实现自动部署tomcat的脚本 由于经常部署war到tomccat上,经常有一些重复的工作要做:停服务.备份war包.上传新的war包.启动服务.索性就写了一个自动部署的脚本. 脚本如下a ...
- Dubbo入门到精通学习笔记(二):Dubbo管理控制台、使用Maven构建Dubbo的jar包、在Linux上部署Dubbo privider服务(shell脚本)、部署consumer服务
文章目录 Dubbo管理控制台 1.Dubbo管理控制台的主要作用: 2.管理控制台主要包含: 3.管理控制台版本: 安装 Dubbo 管理控制台 使用Maven构建Dubbo服务的可执行jar包 D ...
- Kafka~Linux环境下的部署
概念 Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中的所有动作流数据. 这种动作(网页浏览,搜索和其他用户的行动)是在现代网络上的许多社会功能的一个关键因素. 这些数据 ...
- 从头开始构建LINUX[内核更新和资料]
了解了LFS的内容后,至于内核的更新就一目了然了 http://www.cnblogs.com/2018/p/3979305.html http://www.cnblogs.com/2018/p/39 ...
- linux脚本编程(shell)浅介 (转载)
linux脚本(shell)编程 啊,昨天上网看到一篇讲 linux/unix shell 的文章,想想自己最后写这东西也是一年前的事了,想想都快忘光了. 还是整理一下,做一次回顾,以后说不定还用得上 ...
- Linux环境Weblogic10g服务部署
1.先安装XManager: 2.进入XShell,远程连接Linux主机后,按如下操作即可打开XManager配置WebLogic部署服务: [root@server36 bin]# cd /[ro ...
- mosquitto在Linux环境下的部署/安装/使用/测试
mosquitto在Linux环境下的部署 看了有三四天的的源码,(当然没怎么好好看了),突然发现对mosquitto的源码有了一点点感觉,于是在第五天决定在Linux环境下部署mosquitto. ...
随机推荐
- 推荐系统——online(上)
框架介绍 上一篇从总体上介绍了推荐系统,推荐系统online和offline是两个组成部分,其中offline负责数据的收集,存储,统计,模型的训练等工作:online部分负责处理用户的请求,模型数据 ...
- OpenGL中glUniform1i使用
在OpenGL中使用glGetUniformLocation和glUniformxxx等函数时,要在之前启用对应的着色器程序,即调用glUseProgram.
- leetcode 448. Find All Numbers Disappeared in an Array -easy (重要)
题目链接: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/description/ 题目描述: Give ...
- [LeetCode] Next Greater Element III 下一个较大的元素之三
Given a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly th ...
- 【linux之压缩归档,tar】
一.压缩和归档 压缩算法就是等量代换 gzip FILE1 FILE2... 扩展名 .gz -#(数字):#代表压缩等级,1-9,默认6 -d(compression):解压缩 -r:递归的压缩目录 ...
- 小白学习java设计模式之策略模式
策略模式:1.分析项目中的变化部分与不变部分(每个设计模式都要分析的)2.多用组合少用继承;用行为类组合,而不是行为继承,更具有弹性直接上代码: package com.wz.oneStrategis ...
- ●洛谷P1291 [SHOI2002]百事世界杯之旅
题链: https://www.luogu.org/recordnew/show/5861351题解: dp,期望 定义dp[i]表示还剩下i个盖子没收集时,期望还需要多少次才能手机完. 初始值:dp ...
- UVA - 11235:Frequent values
非常优美的RMQ问题,可以运到桶的思想 #include<cstdio> #include<cstdlib> #include<algorithm> #includ ...
- NOIP2014-3-15模拟赛
Problem 1 高级打字机(type.cpp/c/pas) [题目描述] 早苗入手了最新的高级打字机.最新款自然有着与以往不同的功能,那就是它具备撤销功能,厉害吧. 请为这种高级打字机设计一个程序 ...
- [BZOJ]1069: [SCOI2007]最大土地面积
题目大意:给出二维平面上n个点,求最大的由这些点组成的四边形面积.(n<=2000) 思路:求出凸包后旋转卡壳枚举对踵点对作为四边形的对角线,枚举或二分另外两个点,复杂度O(n^2)或O(nlo ...