I am getting a following error while registering a component:

                                       
<stack-trace><![CDATA[javax.jbi.JBIExcep
tion: javax.management.NotCompliantMBeanException: Class does not expose a
manag
ement interface: java.lang.Object
        at
com.dnb.servicemix.jbi.audit.jms.ExchangeListenerComponent.init(Excha
ngeListenerComponent.java:67)
        at
org.apache.servicemix.jbi.framework.ComponentMBeanImpl.init(Component
MBeanImpl.java:201)
        at
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
IContainer.java:1114)
        at
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
IContainer.java:1074)
        at
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
IContainer.java:1031)
        at
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
IContainer.java:979)

Following is the component I am trying to expose:

public interface ExchangeListenerMBean extends LifeCycleMBean{
        
        public void addServiceNames(String[] names) throws AuditorException;
        
        public void removeServiceName(String name) throws AuditorException;
        
        public String[] getServiceNames() throws AuditorException;

}

public class ExchangeListenerComponent extends ComponentSupport implements
                ExchangeListener, ExchangeListenerMBean {
                ...

        protected Class getServiceMBean() {
                return ExchangeListenerMBean.class;
        }

        @Override
        public void init(ComponentContext cc) throws JBIException {
                super.init(cc);
                ObjectName name = getContext().getMBeanNames()
                                
.createCustomComponentMBeanName("ExchangeListenerMBean");
                this.setExtensionMBeanName(name);
                try {
                        getContext().getMBeanServer().registerMBean(this, name);
                } catch (Exception e) {
                        throw new JBIException(e);
                }
                log.info("Exchange Listener Initialized");
        }

        public void shutDown() throws javax.jbi.JBIException {
                super.shutDown();
                try {
                        getContext().getMBeanServer().unregisterMBean(
                                        this.getExtensionMBeanName());
                } catch (Exception e) {
                        new JBIException(e);
                }
        }

        public void addServiceNames(String[] newServices) throws 
AuditorException {
                for (int i = 0; i < newServices.length; i++) {
                        serviceNames.add(newServices[i]);
                }
        }

        public String[] getServiceNames() throws AuditorException {
                return serviceNames.toArray(new String[100]);
        }

        public void removeServiceName(String serviceName) throws 
AuditorException {
                serviceNames.remove(serviceName);
        }

        @Override
        public MBeanOperationInfo[] getOperationInfos() throws JMException {
                OperationInfoHelper helper = new OperationInfoHelper();
                ParameterHelper ph = helper.addOperation(getObjectToManage(),
                                "addServiceNames", 1, "Adds services to the 
audit list");
                ph.setDescription(0, "serviceNames", "List of services to be 
audited");
                helper.addOperation(getObjectToManage(), "getServiceNames",
                                "Retrieves a list of services currently 
audited");
                ph = helper.addOperation(getObjectToManage(), 
"removeServiceName", 1,
                                "Removes a service from audit list");
                ph
                                .setDescription(0, "serviceName",
                                                "Name of the service to be 
removed");
                return OperationInfoHelper.join(super.getOperationInfos(), 
helper
                                .getOperationInfos());
        }


}

Any help on this front will be appreciated
-- 
View this message in context: 
http://www.nabble.com/JMX-MBean-Registration-tf3862885s12049.html#a10943337
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to