我通过JMX远程调用WebLogic中的操作,我正在发送用户和密码,我已在服务器策略中设置了与用户访问JMX操作,但我收到了
Error creating bean with name 'httpJmxConnector':
Invocation of init method failed; nested exception is weblogic.management.NoAccessRuntimeException: Access not allowed for subject: principals=[], on Resource weblogic.management.configuration.AppDeploymentMBean Operation: invoke , Target: lookupSubDeployment
这是我的代码:我错过了什么?
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://theServerAddress:1004/jmxrmi");
// set JMX Server credentials
HashMap environment = new HashMap();
String[] credentials = new String[] {"theUserName", "thePassword"};
environment.put (JMXConnector.CREDENTIALS, credentials);
// connect and get connection to Server
JMXConnector c = JMXConnectorFactory.connect(url, environment);
MBeanServerConnection mbsc = c.getMBeanServerConnection();
// Create object name
ObjectName serviceConfigName = new ObjectName("com.bea:Name=deployedApplication-ear,Type=AppDeployment");
// Invoke operation
mbsc.invoke(serviceConfigName, "lookupSubDeployment", null, null);
c.close();
答案 0 :(得分:0)
请参阅以下网址以正确创建用户
http://weblogic-wonders.com/weblogic/2010/11/30/mbean-authorization-and-creating-jmx-policies/