Announcement Announcement Module
Collapse
No announcement yet.
JMX Export Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMX Export

    Hi!

    I have o problem with JMX export. I have some standard Spring Integration components and I would like to export them via JMX using '<jmx:mbean-export/>'. In my 'app-context.xml' I have added:
    Code:
    <context:mbean-server />
    <jmx:mbean-export/>
    everything seemed to be fine but...
    I have a class ...let say PacketTypeFilter which implements MessageSelector. This class is using another 'DirectChannel' to send some filtered data...
    Code:
    @Component
    public class PacketTypeFilter implements MessageSelector {
    
        @Autowired
        @Qualifier(value = "seqResetChannel")
        private DirectChannel seqResetChannel;
    
        public boolean accept(Message<?> message) {
        }
    }
    but..after deplioying on Eclipse Virgo 3.0.0.M5 I have this exception:
    Code:
    [2011-08-04 15:25:16.258] ERROR start-signalling-8           org.eclipse.virgo.medic.eventlog.default                         DE0006E Start failed for par 'com.x.x.x.x.adapter.assembly' version '0.1.0'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'packetTypeFilter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.integration.channel.DirectChannel com.x.x.x.PacketTypeFilter.seqResetChannel; nested exception is java.lang.IllegalArgumentException: Can not set org.springframework.integration.channel.DirectChannel field com.comarch.cii.rtms.kernel.adapter.workflow.filter.packet.PacketTypeFilter.seqResetChannel to $Proxy303
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
    	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    	at org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.integration.channel.DirectChannel com.x.x.x.x.PacketTypeFilter.seqResetChannel; nested exception is java.lang.IllegalArgumentException: Can not set org.springframework.integration.channel.DirectChannel field com.x.x.x.x.PacketTypeFilter.seqResetChannel to $Proxy303
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:504)
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
    	... 18 common frames omitted
    Caused by: java.lang.IllegalArgumentException: Can not set org.springframework.integration.channel.DirectChannel field com.x.x.x.x.PacketTypeFilter.seqResetChannel to $Proxy303
    	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
    	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
    	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
    	at java.lang.reflect.Field.set(Field.java:657)
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:500)
    	... 20 common frames omitted

  • #2
    OK..I have switched to interface:
    org.springframework.integration.MessageChannel

    ...and it works!

    Comment


    • #3
      Right. DirectChannel is a class while Java proxy mechanism can only proxy the interfaces so when casting such proxy to a name of the class you get that exception. Just as an FYI if you do need to proxy the actual class you can switch CGLIB proxying. Look thru Spring core forums for samples of that (very common)

      Comment


      • #4
        Ok, thanks...I'd rather stay with proxying to interface...

        Comment

        Working...
        X