我需要开发一个用于管理WebSphere Application Server v7.0.0.11的应用程序。我探索了一下,发现我们可以使用Mbeans。实际上我需要创建类似于Web-sphere的Web控制台的东西。
我的问题是应用程序应该在C#.net中,所以是否有任何连接器/适配器来调用web-sphere的管理API。请指出我正确的方向。
我是C#.net开发人员和java / websphere中的新手,我尝试使用IBM / Webshpere / Cimrepos目录中的软件包从IBM站点创建Admin Client示例。 Jar文件的名称是 com.ibm.wplc.was_7.0.0.11.jar
我将该jar文件解压缩到同一文件夹中。
所以现在My App启动,成功连接到websphere并在nodeAgent上找到mbean。我在调用mbean时遇到的问题。我收到以下错误消息。
的 exception invoking launchProcess : javax.management.ReflectionExcetion: Target Method not found com.ibm.ws.management.nodeagent.NodeAgent.launchProcess
的
我正在使用以下网址列出mbean
我尝试使用nodeAgent mbean的不同方法,但没有快乐,我总是得到相同的异常“找不到方法”。
以下是为调用launchprocess
而剪切的代码private void invokeLaunchProcess(String serverName)
{
// Use the launchProcess operation on the NodeAgent MBean to start
// the given server
String opName = "launchProcess";
String signature[] = { "java.lang.String" };
String params[] = { serverName };
boolean launched = false;
try
{
Boolean b = (Boolean)adminClient.invoke(nodeAgent, opName, params, null);
launched = b.booleanValue();
if (launched)
System.out.println(serverName + " was launched");
else
System.out.println(serverName + " was not launched");
}
catch (Exception e)
{
System.out.println("Exception invoking launchProcess: " + e);
}
}
可以在以下链接中找到完整代码
请让我知道我做错了什么,我是否需要包含其他一些包裹?我浏览了com.ibm.wplc.was_7.0.0.11.jar
,com\ibm\ws\managemnt
中没有任何名为nodeagent的文件夹。我在Appserver \ runtimes库中找到了相同的jar文件。
非常感谢任何帮助,在此先感谢。
获取Mbean
private void getNodeAgentMBean(String nodeName)
{
// Query for the ObjectName of the NodeAgent MBean on the given node
try
{
String query = "WebSphere:type=NodeAgent,node=" + nodeName + ",*";
ObjectName queryName = new ObjectName(query);
Set s = adminClient.queryNames(queryName, null);
if (!s.isEmpty())
nodeAgent = (ObjectName)s.iterator().next();
else
{
System.out.println("Node agent MBean was not found");
System.exit(-1);
}
}
catch (MalformedObjectNameException e)
{
System.out.println(e);
System.exit(-1);
}
catch (ConnectorException e)
{
System.out.println(e);
System.exit(-1);
}catch (Exception e){
e.printStackTrace();
System.exit(-1);
}
System.out.println("Found NodeAgent MBean for node " + nodeName);
}
答案 0 :(得分:0)
似乎我的问题是adminClient.invoke方法我没有正确传递参数。在获得正确的参数后,它得到修复。如果有人遇到同样的问题,我希望这会有所帮助。