4 Replies Latest reply on Sep 7, 2012 7:32 AM by Luis

    Servlet throwing 'NoAccessRuntimeException' trying access JMX bean

      I have a servlet where in I access weblogic MBeans. I am getting 'subject: principal does not have access to perform admin actions'. Some attributes I am able to access fine but while trying to access 'DataSource' I believe it is throwing the exception.

      ctx = new InitialContext();
      MBeanServer mBeanCon = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");

      ObjectName runtimeService =
      new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");

      serverConfiguration = (ObjectName) mBeanCon.getAttribute(runtimeService, "ServerConfiguration");

      ObjectName cluster = (ObjectName) mBeanCon.getAttribute(serverConfiguration, "Cluster");

      All the above lines are executed fine. It fails at the following line:
      ObjectName dataSourceForJobScheduler = (ObjectName) mBeanCon.getAttribute(cluster, "DataSourceForJobScheduler");
      ObjectName jdbcDataSourceForJobScheduler =
      (ObjectName) mBeanCon.getAttribute(dataSourceForJobScheduler, "JDBCResource");
      ObjectName jdbcDataSourceForJobSchedulerParmas =
      (ObjectName) mBeanCon.getAttribute(jdbcDataSourceForJobScheduler, "JDBCDataSourceParams");
      String[] jndiNames =
      (String[]) mBeanCon.getAttribute(jdbcDataSourceForJobSchedulerParmas, "JNDINames");

      How can I get around this probelm?

      Thank you,