当前位置: 首页 > news >正文

weblogic中两种不同的运行wlst脚本的方式

第一种方法:

< java classname ="weblogic.WLST" fork ="false" failOnError ="true" >
< classpath refid ="wls.classpath" />
< arg line ="wlst/createCluster.pymydomain" />
</ java >

成功执行

第二种方法

< taskdef name ="wlst"
classname
="weblogic.ant.taskdefs.management.WLSTTask"
classpathref
="wls.classpath" />

< wlst fileName ="wlst/createCluster.py"
arguments
="mydomain"
debug
="true"
failOnError
="true" >
</ wlst >

运行上面脚本后,ant输出如下内容,抛出了异常,但是执行的结果的是正确的,也就是说创建的域是正确的,但是在脚本的最后执行exit()方法时,抛出了异常,我想这里的问题应该是fork的问题,在第一个方法中可以自行控制启动的是否是一个独立的进程,而第二种方法不能控制,只能是一个进程,所以在执行exit()方法时,不但退出了wlst脚本的执行,也退出了ant进程。
抛出的异常


wlst.creatCluster:
[wlst]
< WLSTTask > Addingtest1tosys.argv
[wlst]
< WLSTTask > sys.argvis[ ' wlst/createCluster.py ' , ' test1 ' ]
[wlst]
< WLSTTask > Thescriptthatwillbeexecuted
[wlst]ExitingWebLogicScriptingTool.

BUILDFAILED
F:work_topfounderworkspacecallcenteruild
- wls.xml: 185 :Traceback(innermostlast):
File
" wlstcreateCluster.py " ,line 127 ,in ?
File
" <iostream> " ,line 46 ,inexit
org.eclipse.ant.internal.ui.antsupport.AntSecurityException
atorg.eclipse.ant.internal.ui.antsupport.AntSecurityManager.checkExit(AntSecurityManager.java:
54 )
atjava.lang.Runtime.exit(Runtime.java:
88 )
atjava.lang.System.exit(System.java:
868 )
atweblogic.management.scripting.WLScriptContext.exit(WLScriptContext.java:
579 )
atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39 )
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25 )
atjava.lang.reflect.Method.invoke(Method.java:
585 )
atorg.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:
160 )
atorg.python.core.PyMethod.__call__(PyMethod.java:
96 )
atorg.python.core.PyObject.__call__(PyObject.java:
283 )
atorg.python.core.PyObject.invoke(PyObject.java:
2055 )
atorg.python.pycode._pyx6.exit$
3 ( < iostream > : 46 )
atorg.python.pycode._pyx6.call_function(
< iostream > )
atorg.python.core.PyTableCode.call(PyTableCode.java:
208 )
atorg.python.core.PyTableCode.call(PyTableCode.java:
404 )
atorg.python.core.PyTableCode.call(PyTableCode.java:
253 )
atorg.python.core.PyFunction.__call__(PyFunction.java:
169 )
atorg.python.pycode._pyx16.f$
0 (wlstcreateCluster.py: 127 )
atorg.python.pycode._pyx16.call_function(wlstcreateCluster.py)
atorg.python.core.PyTableCode.call(PyTableCode.java:
208 )
atorg.python.core.PyCode.call(PyCode.java:
14 )
atorg.python.core.Py.runCode(Py.java:
1135 )
atorg.python.core.__builtin__.execfile_flags(__builtin__.java:
308 )
atorg.python.util.PythonInterpreter.execfile(PythonInterpreter.java:
158 )
atweblogic.management.scripting.utils.WLSTInterpreter.execfile(WLSTInterpreter.java:
305 )
atweblogic.ant.taskdefs.management.WLSTTask.execute(WLSTTask.java:
108 )
atorg.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
275 )
atorg.apache.tools.ant.Task.perform(Task.java:
364 )
atorg.apache.tools.ant.Target.execute(Target.java:
341 )
atorg.apache.tools.ant.Target.performTasks(Target.java:
369 )
atorg.apache.tools.ant.Project.executeSortedTargets(Project.java:
1216 )
atorg.apache.tools.ant.Project.executeTarget(Project.java:
1185 )
atorg.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
40 )
atorg.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:
32 )
atorg.apache.tools.ant.Project.executeTargets(Project.java:
1068 )
atorg.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:
423 )
atorg.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:
137 )

org.eclipse.ant.internal.ui.antsupport.AntSecurityException:org.eclipse.ant.internal.ui.antsupport.AntSecurityException

createCluster.py

# =======================================================================================
#
ThisisanexampleofaWLSTofflineconfigurationscript.Thisexampledemonstrates
#
howtocreateasingle-clusterdomain.ThissampleisbasedontheBasicWebLogic
#
ServerDomaintemplate.
#
#
Pleasenotethatmanyvaluesusedinthisscriptaresubjecttochangebased
#
onyourWebLogicinstallationandthetemplateyouareusing.
#
#
Usage:
#
wlstcreatecluster.py<domainname>
#
#
=======================================================================================
import string

# =======================================================================================
#
Openadomaintemplate.
#
=======================================================================================


template
= wlsHome + ' /common/templates/domains/ ' + domainTemplate

readTemplate(template)

# =======================================================================================
#
ConfiguretheAdministrationServerandSSLport.
#
=======================================================================================

cd(
' Servers/AdminServer ' )
set(
' ListenAddress ' , '' )
set(
' ListenPort ' , 7001 )

create(
' AdminServer ' , ' SSL ' )
cd(
' SSL/AdminServer ' )
set(
' Enabled ' , ' True ' )
set(
' ListenPort ' , 7002 )

# =======================================================================================
#
Definethepasswordforuserweblogic.Youmustdefinethepasswordbeforeyou
#
canwritethedomain.
#
=======================================================================================

cd(
' / ' )
cd(
' Security/base_domain/User/weblogic ' )
cmo.setPassword(
' weblogic ' )

# =======================================================================================
#
SetOptions:
#
-CreateStartMenu:EnablecreationofStartMenushortcut.
#
-ServerStartMode:Setmodetodevelopment.
#
-JavaHome:SetshomedirectoryfortheJVMusedwhenstartingtheserver.
#
-OverwriteDomain:Overwritesdomain,whensaving,ifoneexists.
#
=======================================================================================

setOption(
' CreateStartMenu ' , ' false ' )
setOption(
' ServerStartMode ' , ' dev ' )
setOption(
' JavaHome ' ,javaHome)
setOption(
' OverwriteDomain ' , ' true ' )

# =======================================================================================
#
Writethedomainandclosethedomaintemplate.
#
=======================================================================================

writeDomain(beaHome
+ ' /user_projects/domains/ ' + domainName)
closeTemplate()

# =======================================================================================
#
Reopenthedomain.
#
=======================================================================================

readDomain(beaHome
+ ' /user_projects/domains/ ' + domainName)


# =======================================================================================
#
CreatethreeManagedServersandconfigurethem.
#
#
Migratableservers,whichprovideforbothautomaticandmanualmigration
#
attheserver-level,arecreatedautomaticallywhenyoucreatetheManagedServers.
#
=======================================================================================

# 受管服务器的列表,若需要修改修改服务数量,可以修改这个变量,注意不可以重名
mServers = ' ms1 ' , ' ms2 ' , ' ms3 '
startPort
= 8001
for mServer in mServers:
cd(
' / ' )
create(mServer,
' Server ' )
cd(
' Server/ ' + mServer)
set(
' ListenPort ' ,startPort)
startPort
+= 10
set(
' ListenAddress ' , ' localhost ' )


# =======================================================================================
#
CreateandconfigureaclusterandassigntheManagedServerstothatcluster.
#
=======================================================================================

clusterName
= ' wlsCluster '

cd(
' / ' )
create(clusterName,
' Cluster ' )
assign(
' Server ' ,string.join(mServers, ' , ' ), ' Cluster ' ,clusterName)
cd(
' Clusters/ ' + clusterName)
set(
' MulticastAddress ' , ' 237.0.0.101 ' )
set(
' MulticastPort ' , 9200 )
set(
' WeblogicPluginEnabled ' , ' true ' )



# =======================================================================================
#
Writethedomainandclosethedomaintemplate.
#
=======================================================================================

updateDomain()
closeDomain()

# =======================================================================================
#
ExitWLST.
#
=======================================================================================

exit()

相关文章:

  • 微信h5登录php,H5 微信开发接入流程(网页登陆授权JS-SDK授权)
  • java怎么快速添加scanner,java的数据类型(基本数据类型)、 扫描器(Scanner)、Editplus快速完成的设置!...
  • 软件工程专家(左春的专栏)
  • php ajax success,Ajax请求发送成功但不进success如何解决
  • .net专家(张羿专栏)
  • ycmj.php,vim 编译YCM编译出错?求解决办法?
  • 开源代码专家 (胡争辉)
  • momo php framework,momo.php
  • 游戏开发专家 (孙丰国)
  • php工程师的段子,江湖上一些关于程序员的段子
  • Visual Basic专家:马畅
  • php足疗预约,足浴养生管理系统轻松实现各种线上预约功能?
  • mysql 点击,点击页面就自动输入到mysql.求解.
  • 感谢Katty
  • 双反馈直流matlab仿真,双闭环直流调速系统的课程设计(MATLAB仿真)
  • [PHP内核探索]PHP中的哈希表
  • 《深入 React 技术栈》
  • 【RocksDB】TransactionDB源码分析
  • Consul Config 使用Git做版本控制的实现
  • eclipse的离线汉化
  • leetcode讲解--894. All Possible Full Binary Trees
  • Puppeteer:浏览器控制器
  • vue中实现单选
  • 大数据与云计算学习:数据分析(二)
  • 分布式熔断降级平台aegis
  • 一起来学SpringBoot | 第十篇:使用Spring Cache集成Redis
  • 一些关于Rust在2019年的思考
  • 如何在 Intellij IDEA 更高效地将应用部署到容器服务 Kubernetes ...
  • 通过调用文摘列表API获取文摘
  • 资深实践篇 | 基于Kubernetes 1.61的Kubernetes Scheduler 调度详解 ...
  • ​​​​​​​GitLab 之 GitLab-Runner 安装,配置与问题汇总
  • ​软考-高级-信息系统项目管理师教程 第四版【第14章-项目沟通管理-思维导图】​
  • #每天一道面试题# 什么是MySQL的回表查询
  • ( 用例图)定义了系统的功能需求,它是从系统的外部看系统功能,并不描述系统内部对功能的具体实现
  • (floyd+补集) poj 3275
  • (java)关于Thread的挂起和恢复
  • (阿里巴巴 dubbo,有数据库,可执行 )dubbo zookeeper spring demo
  • (待修改)PyG安装步骤
  • (二)springcloud实战之config配置中心
  • (二开)Flink 修改源码拓展 SQL 语法
  • (附源码)springboot“微印象”在线打印预约系统 毕业设计 061642
  • (附源码)ssm捐赠救助系统 毕业设计 060945
  • (附源码)计算机毕业设计SSM基于java的云顶博客系统
  • (力扣)循环队列的实现与详解(C语言)
  • (四)汇编语言——简单程序
  • (五)大数据实战——使用模板虚拟机实现hadoop集群虚拟机克隆及网络相关配置
  • (转载)hibernate缓存
  • (转载)虚函数剖析
  • (转载)虚幻引擎3--【UnrealScript教程】章节一:20.location和rotation
  • .net 托管代码与非托管代码
  • .NET 中的轻量级线程安全
  • @modelattribute注解用postman测试怎么传参_接口测试之问题挖掘
  • @Resource和@Autowired的区别
  • [.NET 即时通信SignalR] 认识SignalR (一)
  • [16/N]论得趣