Announcement Announcement Module
Collapse
No announcement yet.
@Transactional throws "no matching editors or conversion strategy found" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Transactional throws "no matching editors or conversion strategy found"

    Aloha,

    I have a SpringBatch 3.0.0 Project that's reading some XML-Files and writes their content to an Oracle DB.
    Everything worked fine until I thought: "Hey, some transactional behavior here and there would be nice.".
    So I added @Transactional(propagation = Propagation.REQUIRED) on the save-Method of a DAO-Class in my Writer
    and now it ended up in an Exception while initialising the beans ...

    Code:
    [...]nested exception is org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'MY_JOB': Cannot create inner bean '(inner bean)' of type 
    [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean] while setting bean property 'flow'; 
    nested exception is org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.springframework.batch.core.job.flow.support.StateTransition] 
    while setting bean property 'stateTransitions' with key [9]; 
    nested exception is org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name '(inner bean)#9': Cannot create inner bean '(inner bean)' of type [org.springframework.batch.core.job.flow.support.state.StepState] while setting constructor argument; 
    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#9': Cannot resolve reference to bean 'MY_STEP' while setting constructor argument; 
    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MY_STEP': Cannot resolve reference to bean 'compositeWriter' while setting bean property 'itemWriter'; 
    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeWriter' defined in class path resource [META-INF/spring/module-context.xml]: Cannot resolve reference to bean 'MY_DELEGATE_WRITER' while setting bean property 'delegatewriter'; 
    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MY_DELEGATE_WRITER' defined in class path resource [META-INF/spring/module-context.xml]: Initialization of bean failed; 
    nested exception is org.springframework.beans.ConversionNotSupportedException: 
    Failed to convert property value of type '$Proxy12 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.example.MyDAO' for property 'myDAO'; 
    nested exception is java.lang.IllegalStateException: 
    Cannot convert value of type [$Proxy12 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.example.MyDAO] for property 'myDAO': no matching editors or conversion strategy found
    My TransactionManager is configured like this:

    Code:
    <tx:annotation-driven transaction-manager="transactionManager"/>
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
        <property name="dataSource" ref="dataSource" />
    </bean>
    Do I have to add anything else in the context.xml to make @Transactional work?

    Thanks in advance ...

  • #2
    Please use the search, as this question has been answered numerous times before.

    Short answer: Either program to interfaces or use class proxies.

    Comment


    • #3
      Thanks for the short answer, Marten.

      I added proxy-target-class="true" at the tx:-statement

      Code:
      <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
      and after adding CGLIB to my dependencies it finally worked ...

      Comment

      Working...
      X