首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 软件时空 > 软件相关 > 不知道如何用程序控制WebSphere应用的启动、停止、重启?
【标  题】:不知道如何用程序控制WebSphere应用的启动、停止、重启?
【关键字】:WebSphere
【来  源】:http://www.cublog.cn/u/18156/showart.php?id=109618

不知道如何用程序控制WebSphere应用的启动、停止、重启?

通常Web应用的停止、启动、重启只需要管理员来做,可是我有个系统为了能使应用切换数据库,而需要让用户来操作,其实用户不知道这么多内部操作,他只知道我点击了一个连接,然后应用就切换到另外一个数据库了。殊不知,后台还需要重启应用才能生效,于是我要使用程序来控制,我的应用服务器系统是WebSphere,以前是Tomcat,我用程序写了代码可以使Tomcat的应用启动、停止、重启操作,可是WebSphere我不知道如何写了,查找了相关资料,看到一些代码:
//--代码:
    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);
        }
    }
可是,似乎没有成功,WebSphere的配置我也看了,应该没什么问题。
我还把WebSphere的代码反编译了,可是看不懂,太复杂了,郁闷啊。
继续研究……
php.ini 中文版:【上一篇】
数学之我见:【下一篇】
【相关文章】
  • WAS 6与Websphere MQ6的整合
  • websphere管理资料
  • WebSphere Product family overview
  • AIX5.3下安装Websphere心得
  • WebSphere学习笔记一
  • 在AIX5上安装WebSphere Application Server 5.1
  • 管理Websphere的10个有用命令
  • Websphere Portal Express for iSeries 安装及配置
  • WebSphere Application Server 6.0安全认证与已有系统的用户数据库整合实
  • 基于HPUX安装websphere5.0
  • 【随机文章】
  • 04年度中国市场主流防火墙产品评测技术报告(1)
  • SQL修改字段函数
  • 頻寬與處理器能力
  • [转]我的Java学习之路
  • Solaris 10安装向导
  • 钩子及其应用(二)
  • 齐全的H.323协议文档
  • 晕,还得改IP
  • 《阿玛迪斯战记》文件格式全分析
  • Howto use DAG packages with apt or yum
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.