You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by vikas kumar <pv...@gmail.com> on 2006/09/06 11:07:43 UTC

The BAMComponent and MBean!

Hi..
Tried configuring the BAMComponent to get configuration data from
MBean instead of the file-system..

Added the following to the BAMEndpoint

public BAMConfiguration getConfiguration() {
        BAMLifeCycle lifeCycle = (BAMLifeCycle)
getServiceUnit().getComponent().getLifeCycle();
        return lifeCycle.getConfiguration();
    }

Added the following to the BAMLifecycle

    public BAMLifeCycle(BaseComponent component) {
        super(component);
        configuration = new BAMConfiguration();
    }
    protected Object getExtensionMBean() throws Exception {
        return configuration;
    }
   public BAMConfiguration getConfiguration() {
	return configuration;
   }
   public void setConfiguration(BAMConfiguration configuration) {
            this.configuration = configuration;
  }


I thought I'll be able to view a configuration MBean using JConsole..
But its not registered..
I can view the Component and Endpoint MBeans though..

Any leads on what should be done to automatically register MBeans when
an endpoint starts?

~Vikas

Re: The BAMComponent and MBean!

Posted by Guillaume Nodet <gn...@gmail.com>.
servicemix-common is now included in the servicemix-shared
Shared Library which should be referenced by all components.
This maked these components able to deploy in another
JBI container (for those who really want it).

If there is no dependencies from the BAM component to the
servicemix-shared SA, it's on oversight.

Btw, feel free to hack the User Guide, or even list topics you'd
like to be covered: it would help !

On 9/7/06, vikas kumar <pv...@gmail.com> wrote:
>
> Thanks Guillaume..
>
> Had some issues, but things worked out after I built SM from source..
> Can view the MBean now..
>
> But I happened to notice the following error when trying to start the
> component...
>
> Bean ''; nested exception is java.lang.NoClassDefFoundError:
> org/apache/servicem
> ix/common/BaseComponent
>         at
> org.springframework.beans.factory.parsing.FailFastProblemReporter.err
> or(FailFastProblemReporter.java:56)
>         at org.springframework.beans.factory.support.ReaderContext.error
> (ReaderC
> ontext.java:74)
>         at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er
> ror(BeanDefinitionParserDelegate.java:1181)
>         at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
> rseBeanDefinitionElement(BeanDefinitionParserDelegate.java:552)
>         at
> org.apache.xbean.spring.context.v2b.XBeanBeanDefinitionParserDelegate
> .parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:61)
>         at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
> rseBeanDefinitionElement(BeanDefinitionParserDelegate.java:398)
>         at
> org.apache.xbean.spring.context.v2b.XBeanNamespaceHandler.parseBeanFr
> omExtensionElement(XBeanNamespaceHandler.java:205)
>         at
> org.apache.xbean.spring.context.v2b.XBeanNamespaceHandler.parseBeanFr
> omExtensionElement(XBeanNamespaceHandler.java:253)
>
> I worked around the above exception by manually copying the SM-Common
> jar into lib/optionals but why is the 'servicemix-common' jar not
> present in the lib by default?
>
> ~Vikas
>
> ps: Checked SM userguide link.. looks great.. eagerly waiting for it
> to complete..
>
> On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > It should work.
> > Put a breakpoint in getExtensionMBean and try to debug.
> > It should be called by the container.
> >
> > On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> > >
> > > Hi..
> > >
> > > public interface BAMConfigurationMBean {
> > >         public String getActions();
> > >         public String getRules();
> > >         public String getGlobalConfig();
> > >
> > >         public void setActions(String action);
> > >         public void setRules(String rules);
> > >         public void setGlobalConfig(String globalConfig);
> > > }
> > >
> > > Thats the MBean Interface.. And I do have a samle Implementation. I
> > > have packaged them in the same package as the original BAMComponent
> > > "org.apache.servicemix.bam"
> > >
> > >
> > >
> > > On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > Did you write a BAMConfigurationMBean interface and
> > > > make BAMConfiguration implement it ?
> > > >
> > > > On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> > > > >
> > > > > Hi..
> > > > > Tried configuring the BAMComponent to get configuration data from
> > > > > MBean instead of the file-system..
> > > > >
> > > > > Added the following to the BAMEndpoint
> > > > >
> > > > > public BAMConfiguration getConfiguration() {
> > > > >         BAMLifeCycle lifeCycle = (BAMLifeCycle)
> > > > > getServiceUnit().getComponent().getLifeCycle();
> > > > >         return lifeCycle.getConfiguration();
> > > > >     }
> > > > >
> > > > > Added the following to the BAMLifecycle
> > > > >
> > > > >     public BAMLifeCycle(BaseComponent component) {
> > > > >         super(component);
> > > > >         configuration = new BAMConfiguration();
> > > > >     }
> > > > >     protected Object getExtensionMBean() throws Exception {
> > > > >         return configuration;
> > > > >     }
> > > > >    public BAMConfiguration getConfiguration() {
> > > > >         return configuration;
> > > > >    }
> > > > >    public void setConfiguration(BAMConfiguration configuration) {
> > > > >             this.configuration = configuration;
> > > > >   }
> > > > >
> > > > >
> > > > > I thought I'll be able to view a configuration MBean using
> JConsole..
> > > > > But its not registered..
> > > > > I can view the Component and Endpoint MBeans though..
> > > > >
> > > > > Any leads on what should be done to automatically register MBeans
> when
> > > > > an endpoint starts?
> > > > >
> > > > > ~Vikas
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>



-- 
Cheers,
Guillaume Nodet

Re: The BAMComponent and MBean!

Posted by vikas kumar <pv...@gmail.com>.
Thanks Guillaume..

Had some issues, but things worked out after I built SM from source..
Can view the MBean now..

But I happened to notice the following error when trying to start the
component...

Bean ''; nested exception is java.lang.NoClassDefFoundError: org/apache/servicem
ix/common/BaseComponent
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:56)
        at org.springframework.beans.factory.support.ReaderContext.error(ReaderC
ontext.java:74)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er
ror(BeanDefinitionParserDelegate.java:1181)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseBeanDefinitionElement(BeanDefinitionParserDelegate.java:552)
        at org.apache.xbean.spring.context.v2b.XBeanBeanDefinitionParserDelegate
.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:61)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseBeanDefinitionElement(BeanDefinitionParserDelegate.java:398)
        at org.apache.xbean.spring.context.v2b.XBeanNamespaceHandler.parseBeanFr
omExtensionElement(XBeanNamespaceHandler.java:205)
        at org.apache.xbean.spring.context.v2b.XBeanNamespaceHandler.parseBeanFr
omExtensionElement(XBeanNamespaceHandler.java:253)

I worked around the above exception by manually copying the SM-Common
jar into lib/optionals but why is the 'servicemix-common' jar not
present in the lib by default?

~Vikas

ps: Checked SM userguide link.. looks great.. eagerly waiting for it
to complete..

On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> It should work.
> Put a breakpoint in getExtensionMBean and try to debug.
> It should be called by the container.
>
> On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> >
> > Hi..
> >
> > public interface BAMConfigurationMBean {
> >         public String getActions();
> >         public String getRules();
> >         public String getGlobalConfig();
> >
> >         public void setActions(String action);
> >         public void setRules(String rules);
> >         public void setGlobalConfig(String globalConfig);
> > }
> >
> > Thats the MBean Interface.. And I do have a samle Implementation. I
> > have packaged them in the same package as the original BAMComponent
> > "org.apache.servicemix.bam"
> >
> >
> >
> > On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > Did you write a BAMConfigurationMBean interface and
> > > make BAMConfiguration implement it ?
> > >
> > > On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> > > >
> > > > Hi..
> > > > Tried configuring the BAMComponent to get configuration data from
> > > > MBean instead of the file-system..
> > > >
> > > > Added the following to the BAMEndpoint
> > > >
> > > > public BAMConfiguration getConfiguration() {
> > > >         BAMLifeCycle lifeCycle = (BAMLifeCycle)
> > > > getServiceUnit().getComponent().getLifeCycle();
> > > >         return lifeCycle.getConfiguration();
> > > >     }
> > > >
> > > > Added the following to the BAMLifecycle
> > > >
> > > >     public BAMLifeCycle(BaseComponent component) {
> > > >         super(component);
> > > >         configuration = new BAMConfiguration();
> > > >     }
> > > >     protected Object getExtensionMBean() throws Exception {
> > > >         return configuration;
> > > >     }
> > > >    public BAMConfiguration getConfiguration() {
> > > >         return configuration;
> > > >    }
> > > >    public void setConfiguration(BAMConfiguration configuration) {
> > > >             this.configuration = configuration;
> > > >   }
> > > >
> > > >
> > > > I thought I'll be able to view a configuration MBean using JConsole..
> > > > But its not registered..
> > > > I can view the Component and Endpoint MBeans though..
> > > >
> > > > Any leads on what should be done to automatically register MBeans when
> > > > an endpoint starts?
> > > >
> > > > ~Vikas
> > > >
> > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> > >
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>

Re: The BAMComponent and MBean!

Posted by Guillaume Nodet <gn...@gmail.com>.
It should work.
Put a breakpoint in getExtensionMBean and try to debug.
It should be called by the container.

On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
>
> Hi..
>
> public interface BAMConfigurationMBean {
>         public String getActions();
>         public String getRules();
>         public String getGlobalConfig();
>
>         public void setActions(String action);
>         public void setRules(String rules);
>         public void setGlobalConfig(String globalConfig);
> }
>
> Thats the MBean Interface.. And I do have a samle Implementation. I
> have packaged them in the same package as the original BAMComponent
> "org.apache.servicemix.bam"
>
>
>
> On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > Did you write a BAMConfigurationMBean interface and
> > make BAMConfiguration implement it ?
> >
> > On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> > >
> > > Hi..
> > > Tried configuring the BAMComponent to get configuration data from
> > > MBean instead of the file-system..
> > >
> > > Added the following to the BAMEndpoint
> > >
> > > public BAMConfiguration getConfiguration() {
> > >         BAMLifeCycle lifeCycle = (BAMLifeCycle)
> > > getServiceUnit().getComponent().getLifeCycle();
> > >         return lifeCycle.getConfiguration();
> > >     }
> > >
> > > Added the following to the BAMLifecycle
> > >
> > >     public BAMLifeCycle(BaseComponent component) {
> > >         super(component);
> > >         configuration = new BAMConfiguration();
> > >     }
> > >     protected Object getExtensionMBean() throws Exception {
> > >         return configuration;
> > >     }
> > >    public BAMConfiguration getConfiguration() {
> > >         return configuration;
> > >    }
> > >    public void setConfiguration(BAMConfiguration configuration) {
> > >             this.configuration = configuration;
> > >   }
> > >
> > >
> > > I thought I'll be able to view a configuration MBean using JConsole..
> > > But its not registered..
> > > I can view the Component and Endpoint MBeans though..
> > >
> > > Any leads on what should be done to automatically register MBeans when
> > > an endpoint starts?
> > >
> > > ~Vikas
> > >
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>



-- 
Cheers,
Guillaume Nodet

Re: The BAMComponent and MBean!

Posted by vikas kumar <pv...@gmail.com>.
Hi..

public interface BAMConfigurationMBean {
	public String getActions();
	public String getRules();
	public String getGlobalConfig();
	
	public void setActions(String action);
	public void setRules(String rules);
	public void setGlobalConfig(String globalConfig);
}

Thats the MBean Interface.. And I do have a samle Implementation. I
have packaged them in the same package as the original BAMComponent
"org.apache.servicemix.bam"



On 9/6/06, Guillaume Nodet <gn...@gmail.com> wrote:
> Did you write a BAMConfigurationMBean interface and
> make BAMConfiguration implement it ?
>
> On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
> >
> > Hi..
> > Tried configuring the BAMComponent to get configuration data from
> > MBean instead of the file-system..
> >
> > Added the following to the BAMEndpoint
> >
> > public BAMConfiguration getConfiguration() {
> >         BAMLifeCycle lifeCycle = (BAMLifeCycle)
> > getServiceUnit().getComponent().getLifeCycle();
> >         return lifeCycle.getConfiguration();
> >     }
> >
> > Added the following to the BAMLifecycle
> >
> >     public BAMLifeCycle(BaseComponent component) {
> >         super(component);
> >         configuration = new BAMConfiguration();
> >     }
> >     protected Object getExtensionMBean() throws Exception {
> >         return configuration;
> >     }
> >    public BAMConfiguration getConfiguration() {
> >         return configuration;
> >    }
> >    public void setConfiguration(BAMConfiguration configuration) {
> >             this.configuration = configuration;
> >   }
> >
> >
> > I thought I'll be able to view a configuration MBean using JConsole..
> > But its not registered..
> > I can view the Component and Endpoint MBeans though..
> >
> > Any leads on what should be done to automatically register MBeans when
> > an endpoint starts?
> >
> > ~Vikas
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>

Re: The BAMComponent and MBean!

Posted by Guillaume Nodet <gn...@gmail.com>.
Did you write a BAMConfigurationMBean interface and
make BAMConfiguration implement it ?

On 9/6/06, vikas kumar <pv...@gmail.com> wrote:
>
> Hi..
> Tried configuring the BAMComponent to get configuration data from
> MBean instead of the file-system..
>
> Added the following to the BAMEndpoint
>
> public BAMConfiguration getConfiguration() {
>         BAMLifeCycle lifeCycle = (BAMLifeCycle)
> getServiceUnit().getComponent().getLifeCycle();
>         return lifeCycle.getConfiguration();
>     }
>
> Added the following to the BAMLifecycle
>
>     public BAMLifeCycle(BaseComponent component) {
>         super(component);
>         configuration = new BAMConfiguration();
>     }
>     protected Object getExtensionMBean() throws Exception {
>         return configuration;
>     }
>    public BAMConfiguration getConfiguration() {
>         return configuration;
>    }
>    public void setConfiguration(BAMConfiguration configuration) {
>             this.configuration = configuration;
>   }
>
>
> I thought I'll be able to view a configuration MBean using JConsole..
> But its not registered..
> I can view the Component and Endpoint MBeans though..
>
> Any leads on what should be done to automatically register MBeans when
> an endpoint starts?
>
> ~Vikas
>



-- 
Cheers,
Guillaume Nodet