db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3424) Add an MBean that an application can register to change the state of Derby's JMX management
Date Tue, 19 Feb 2008 01:00:35 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570069#action_12570069
] 

Daniel John Debrunner commented on DERBY-3424:
----------------------------------------------

John, thanks for providing the example code to try and register the Management bean from a
remote client, saved me having to figure it out! :-)

I found the problem was simply the class o.a.d.mbeans.Management was not being added to derby.jar.

Here's an expanded version of your code snippet, it adds providing a user name and password
for jmx and invoking the startManagement method. It also changes the domain and key properties
the MBean is registered in, since the MBean is being registered by an application it should
probably not be in Derby's domain.

JMXServiceURL url = new JMXServiceURL(
                    "service:jmx:rmi:///jndi/rmi://" + "localhost" + ":" + 1999 +"/jmxrmi");

HashMap<String,String[]> env = new HashMap<String,String[]>(); 
String[] credentials = new String[] { "username", "password" }; 
env.put("jmx.remote.credentials", credentials); 

JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
MBeanServerConnection mbeanServerConn = jmxc.getMBeanServerConnection();
ObjectName mgmtObjName = new ObjectName("com.myapp.mydomain", "type", "DerbyManagement");
ObjectInstance mgmtObj = mbeanServerConn.createMBean("org.apache.derby.mbeans.Management",
mgmtObjName);

mbeanServerConn.invoke(mgmtObj.getObjectName(), "startManagement", new Object[0], new String[0]);

Just here for reference, it's hard to find examples on the web that show authentication working
with JMX.

With this I was able to create the bean from the remote client and invoke it to start Derby's
JMX management even though derby.system.jmx was false initially.


> Add an MBean that an application can register to change the state of Derby's JMX management
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3424
>                 URL: https://issues.apache.org/jira/browse/DERBY-3424
>             Project: Derby
>          Issue Type: New Feature
>            Reporter: Daniel John Debrunner
>            Assignee: Daniel John Debrunner
>            Priority: Minor
>
> JMX in Derby was originally proposed as a mechanism to configure Derby replacing or enhancing
the system properties which tend to be static in nature. Thus it is somewhat ironic that jmx
is enabled with a static system property derby.system.jmx.
> I propose to add a public mbean that allows the state Derby's JMX management to be changed.
This bean is not automatically registered by Derby if derby.system.jmx is false, but instead
can be registered by an application. I believe this could occur at any time so that JMX could
be enabled on a running application, possibly by a remote client.
> This standard Mbean (o.a.d.mbeans.Management & ManagementMBean) would have these
operations & attribute:
>     public boolean isManagementActive();
>     public void startManagement(); 
>     public void stopManagement();
> If Derby is not booted within the jvm then the operations would be no-ops.
> If derby.system.jmx is true then Derby will itself register an mbean that implements
ManagementMBean to allow dynamic control of the visibility of Derby's mbeans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message