我正在尝试实施" JDBCResourcesWithJMX"样品。在评论中声明"代码可以配置为: - 创建节点或服务器作用域对象 - "
"是否有使用它的解决方法" cluster"作用域&#34?; 我的群集代码部分在
之下AdminClient adminClient = AdminClientFactory.createAdminClient(connectProps);
Session session = new Session();
// use node scope to create config objects
ObjectName scope = null;
if (createNodeScopedCfgObjs) {
scope = ConfigServiceHelper.createObjectName(null, "Node", null);
} else { // unless server scope is configured
scope = ConfigServiceHelper.createObjectName(null, "Cluster", "ClusterName");
}
当我通过" cluster"作为范围对象,我收到以下错误...
[1/15/18 17:17:55:451 TRT] 000001dd SystemErr R Caused by: com.ibm.websphere.management.exception.InvalidConfigDataTypeException: ADMG0007E: The configuration data type Cluster is not valid.
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at com.ibm.ws.management.configservice.DocAccessor.getTypedObjects(DocAccessor.java:533)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at com.ibm.ws.management.configservice.ConfigServiceImpl.getAllBasic(ConfigServiceImpl.java:2601)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at com.ibm.ws.management.configservice.ConfigServiceImpl.queryConfigObjects(ConfigServiceImpl.java:953)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at java.lang.reflect.Method.invoke(Method.java:620)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:88)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
[1/15/18 17:17:55:460 TRT] 000001dd SystemErr R at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at java.lang.reflect.Method.invoke(Method.java:620)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:292)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1261)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at java.security.AccessController.doPrivileged(AccessController.java:426)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:92)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832)
[1/15/18 17:17:55:461 TRT] 000001dd SystemErr R at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at java.lang.reflect.Method.invoke(Method.java:620)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:488)
[1/15/18 17:17:55:462 TRT] 000001dd SystemErr R at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:324)
[1/15/18 17:17:55:463 TRT] 000001dd SystemErr R at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:65)
[1/15/18 17:17:55:463 TRT] 000001dd SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:733)
[1/15/18 17:17:55:463 TRT] 000001dd SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:522)""
答案 0 :(得分:0)
ServerCluster是关键字。下面是完整的代码
scope = ConfigServiceHelper.createObjectName(null, "ServerCluster", "ClusterName");