Chinaunix
标题:
如何使用程序控制WebSphere应用的启动、停止、重启等?
[打印本页]
作者:
wsd001
时间:
2006-04-28 23:18
标题:
如何使用程序控制WebSphere应用的启动、停止、重启等?
我想通过java写程序控制Websphere中已安装应用的启动、停止、重启,可是不知道怎么写?
通过创建AdminClient来控制?我没试成功:(
//--代码:
private void createAdminClient() {
// Set up a Properties object for the JMX connector attributes
Properties connectProps = new Properties();
connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
AdminClient.CONNECTOR_TYPE_SOAP);
connectProps.setProperty(AdminClient.CONNECTOR_HOST, "192.168.0.211");
connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880");
connectProps.setProperty(AdminClient.USERNAME, "administrator");
connectProps.setProperty(AdminClient.PASSWORD, "abc");
connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED , "true");
try {
adminClient = AdminClientFactory.createAdminClient(connectProps);
} catch (ConnectorException e) {
System.out.println("Exception creating admin client.");
e.printStackTrace();
System.exit(-1);
} catch (Exception e){
System.out.println(e);
}
}
//--
private void invokeStopApplication(String serverName) {
// Use the launchProcess operation on the NodeAgent MBean to start
// the given server
String opName = "stopApplication";
String signature[] = { "java.lang.String" };
String params[] = { serverName };
boolean launched = false;
try {
Boolean b = (Boolean) adminClient.invoke(
nodeAgent, opName, params, signature);
launched = b.booleanValue();
if (launched)
System.out.println(serverName + " was stoped");
else
System.out.println(serverName + " was not stoped");
} catch (Exception e) {
System.out.println("Exception invoking stopApplication: " + e);
}
}
有谁帮我么?应该怎么做?
作者:
startkill
时间:
2006-04-29 10:03
好象没什么好办法,呵呵`这个俺不是很懂。。
作者:
wsd001
时间:
2006-04-29 12:44
WebSphere管理控制台中,企业应用程序选中之后,有停止、启动、重启按钮,我把它的代码反编译,可是看不懂。
作者:
startkill
时间:
2006-04-29 13:04
他里面很多东西都做到类里面了`有些东西是看不到的`
作者:
wsd001
时间:
2006-04-29 18:14
怎么办?哪位精通人士传授一下?
作者:
lklgdkp
时间:
2006-04-29 22:37
WAS的wsadmin支持jython和jacl的脚本,写脚本比写java应用程序快多了。
作者:
wsd001
时间:
2006-04-30 09:34
可是我怎么在远程(web上一个超链接)控制这个动作呢?
作者:
wsd001
时间:
2006-05-07 21:23
没人知道吗?
顶一下先。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2