Prathiba,

Right you are, my mistake... Adding it to <sm:services/> only works if you your listener inherits from BaseSystemService -- for your use case you can do this by extending AbstractAuditor. If you want to register a plain listener, as you are trying to do, you can add it to an <sm:listeners/> element (on the same level as where the <sm:services/> are) instead.

Hth,

Gert

pratibhaG wrote:
Followed exactly the same thing that you suggested,

1)This is what I added in conf/servicemix.xml
<sm:services>
      <sm:statistics statsInterval="10" dumpStats="true" />
        <bean id="errorBean" class="errorhandling.ExceptionListenerService" />
</sm:services>

here <sm:statistics statsInterval="10" dumpStats="true" /> was already
there.
 I added <bean id="errorBean" class="errorhandling.ExceptionListenerService"
/>

2)created a jar file and put it in lib/optional

3)Tried to restart servicemix I think there is some type mismatch. It is expecting
org.apache.servicemix.jbi.management.BaseSystemService where as my
servicetype is errorhandling.ExceptionListenerService. How can I get rid of
it? suggestions?

here is the error:
Loading Apache ServiceMix from servicemix.xml on the CLASSPATH
INFO  - ConnectorServerFactoryBean     - JMX connector available at:
service:jmx:rmi:///jndi/rmi://localhost:1077/jmxrmi
Caught: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'jbi' defined in class path resource
[servicemix.xml]: Error setting property values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [java.util.ArrayList] to required
type [org.apache.servicemix.jbi.management.BaseSystemService[]] for property
'services'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [errorhandling.ExceptionListenerService] to required
type [org.apache.servicemix.jbi.management.BaseSystemService] for property
'services[1]': no matching editors or conversion strategy found
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'jbi' defined in class path resource [servicemix.xml]: Error
setting property values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [java.util.ArrayList] to required
type [org.apache.servicemix.jbi.management.BaseSystemService[]] for property
'services'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [errorhandling.ExceptionListenerService] to required
type [org.apache.servicemix.jbi.management.BaseSystemService] for property
'services[1]': no matching editors or conversion strategy found
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property
value of type [java.util.ArrayList] to required type
[org.apache.servicemix.jbi.management.BaseSystemService[]] for property
'services'; nested exception is java.lang.IllegalArgumentException: Cannot
convert value of type [errorhandling.ExceptionListenerService] to required
type [org.apache.servicemix.jbi.management.BaseSystemService] for property
'services[1]': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type
[errorhandling.ExceptionListenerService] to required type
[org.apache.servicemix.jbi.management.BaseSystemService] for property
'services[1]': no matching editors or conversion strategy found
        at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
        at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:124)
        at
org.springframework.beans.TypeConverterDelegate.convertToTypedArray(TypeConverterDelegate.java:337)
        at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:200)
        at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
        at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815)
        at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
        at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
        at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1126)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at
org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:161)
        at
org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:51)
        at org.apache.servicemix.Main.main(Main.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)




Reply via email to