使用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. ...
随机推荐
- SpringMVC之数据传递二
上一篇学习了从url或view中传数据到Controller中,今天学习下数据从Controller传到view中,主要有4种. 一.ModelAndView 处理方法返回值类型为 ModelAndV ...
- 聊聊Servlet、Struts1、Struts2以及SpringMvc中的线程安全
前言 很多初学者,甚至是工作1-3年的小伙伴们都可能弄不明白?servlet Struts1 Struts2 springmvc 哪些是单例,哪些是多例,哪些是线程安全? 在谈这个话题之前,我们先了解 ...
- MyBatis基础学习笔记--自总结
一.MyBatis和jdbc的区别 jdbc的过程包括: 1.加载数据库驱动. 2.建立数据库连接. 3.编写sql语句. 4.获取Statement:(Statement.PrepareStatem ...
- rem ~~ 你懂了吗?
前端 开发的适配中 rem 有着举足轻重的位置,用好了,你就是神,用不好 ,直接GG:不好懵懵懂懂,要头头是道. 言归正传: 首先我们需要了解,css 布局的单位常用的有一下几种: 1.px (pix ...
- [LeetCode] Solve the Equation 解方程
Solve a given equation and return the value of x in the form of string "x=#value". The equ ...
- Headless Chrome:服务端渲染JS站点的一个方案【中篇】【翻译】
接上篇 防止重新渲染 其实说不对客户端代码做任何修改是忽悠人的.在我们的Express 应用中,通过Puppteer加载页面,提供给客户端响应,但是这个过程是有一些问题的. js脚本在服务端的Head ...
- 机器学习技法:10 Random Forest
Roadmap Random Forest Algorithm Out-Of-Bag Estimate Feature Selection Random Forest in Action Summar ...
- Ubuntu重装mysql错误解决
新搭建的服务器,先在Ubuntu上安装mariadb,后来由于很多权限问题,决定安装Mysql,在卸载过程中由于未卸载干净,导致mysql重装过程中出现了很多问题. Reading package l ...
- [Luogu 2817]宋荣子的城堡
Description saruka有一座大大的城堡!城堡里面有n个房间,每个房间上面都写着一个数字p[i].有一天,saruka邀请他的小伙伴LYL和 MagHSK来城堡里玩耍(为什么没有妹子),他 ...
- java的泛型
泛型概述 先看下面的代码: ArrayList al1 = new ArrayList(); ArrayList al2 = new ArrayList(); al1.add("hello& ...