我可以独立连接wlst并在其他脚本上使用它的功能

时间:2014-03-19 09:20:22

标签: python wlst

我有一个脚本conn.py,在脚本中有一个名为conn()的函数使用connect(username,password,url)来连接weblogic域。并有一个脚本createServer.py

__main__: 
    import conn
conn.conn() 
cmo.createServer()

我在createServer()上收到错误,在运行conn.conn()后似乎自动断开连接(),我怎样才能通过这种方式使用WLST在线功能?

---------------------我的控制台返回-------------

starting the script ....
input your user name : weblogic
input your user password : weblogic456
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'demo'.

Warning: An insecure protocol was used to connect to the 
server. To ensure on-the-wire security, the SSL port or 
Admin port should be used instead.

connect OK.

You will need to be connected to a running server to execute this command


You will need to be connected to a running server to execute this command

Error: No domain or domain template has been read.
Problem invoking WLST - Traceback (innermost last):
  File "/home/chopperlee/Program/Workspace/configWL/wlst/createServer.py", line 84, in ?
  File "/home/chopperlee/Program/Workspace/configWL/wlst/createServer.py", line 37, in createServer
AttributeError: 'NoneType' object has no attribute 'createServer'

2 个答案:

答案 0 :(得分:0)

请查看createServer.py",第37行,84行中缺少任何参数。

答案 1 :(得分:0)

WLST connect函数设置一些全局变量,在python中实际上是模块的全局变量 - 在你的情况下是conn模块 - 而不是整个python运行时。

因此,连接实际上在conn模块的上下文中工作。如果从conn模块内部调用,则依赖于 - 并检查 - 连接的其他WLST命令可能会起作用。

但是从conn模块记录该连接的全局变量对于您的主脚本或从那里调用的WLST命令是不可见的,因此从主脚本运行时需要连接的WLST命令会失败。

相关问题