Announcement Announcement Module
Collapse
No announcement yet.
Problem proxying with Quartz MethodInvokingJobDetailFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem proxying with Quartz MethodInvokingJobDetailFactoryBean

    Hi all,
    I'm using Spring 2.5.1, Quartz 1.5.2 on JDK 1.4.2

    I have a problem using the org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean.

    As I understand the problem comes from an AOP problem.

    Here is my configuration :

    Code:
      <bean id="cacheManager" class="xx.yy.TraderCacheManagerImpl">
    
      <bean id="ehcacheJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="cacheManager" />
        <property name="targetMethod" value="flush" />
        <property name="concurrent" value="false" />
      </bean>
    
      <bean id="ehcacheTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
        <property name="jobDetail" ref="ehcacheJob" />
        <property name="startDelay" value="5000" />
        <property name="repeatInterval" value="5000" />
      </bean>
    The error I get when I load Spring context is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy29] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found

    Code:
    org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy29] to required type [org.quartz.JobDetail] for property 'jobDetail'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy29] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
    	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
    	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1198)
    I have followed the documentation. I don't see any errors.
    I probably do something wrong.
    Do you have any advice to revolve my problem ?

    Thanks a lot for you help.
    Hervé

  • #2
    Hi all,

    I have found my problem.

    I'm use <aop:config> in my Spring context. So Spring was creating a proxy automatically for all beans.
    I don't know why but the SimpleTriggerBean doesn't support injecting a proxy instead of the object itself.

    Any idea ?
    Hervé

    Comment


    • #3
      Ok, I found the solution.
      I have added <aop:scoped-proxy proxy-target-class="true" /> in the bean MethodInvokingJobDetailFactoryBean.

      Code:
        <bean id="ehcacheJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
          <property name="targetObject" ref="cacheManager" />
          <property name="targetMethod" value="flush" />
          <property name="concurrent" value="false" />
          <aop:scoped-proxy proxy-target-class="true" />
        </bean>
      Hope this will help others !
      Hervé

      Comment

      Working...
      X