Announcement Announcement Module
No announcement yet.
tx:advise won't work Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • tx:advise won't work


    Im using the new spring schema's to rewrite my dataContext.xml. Now i'm trying to use the tx schema with the tx:advice and transactionManagement but i get this weird error:

    HTML Code:
    org.springframework.core.ConstantException: Field 'PROPAGATION_' not found
    in class [org.springframework.transaction.TransactionDefinition]
    	at org.springframework.core.Constants.asObject(
    	at org.springframework.core.Constants.asNumber(
    	at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.parseAttributes(
    	at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.doParse(
    This is the AOP part of the XML i'm using:

    HTML Code:
    	<!-- turn on autoproxy -->
    		<aop:pointcut id="entryPoint" expression="execution(* com.nefli.camelot.logic.manager.*.*(..))"/>
            <aop:advisor advice-ref="txAdvice" pointcut-ref="entryPoint" /> 
        <tx:advice id="txAdvice" transaction-manager="transactionManager">
                <tx:method name="get*" read-only="true" />
                <tx:method name="*" />
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        	<property name="sessionFactory" ref="sessionFactory"/>
    AOP is working fine when i use my own classes, but the tx manager will not work.

    The exception is suggesting i did not set the "PROPAGATION_REQUIRED".. but that should be default. Also when i set the PROPGATION_REQUIRED in the tx:method tag i get a similar error about "ISOLATION".. But when i set the isolation="DEFAULT" i get a java.lang.NumberFormatException: For input string: "" from the same TxAdviceBeanDefinitionParser.

    Is it using the wrong parser or something? or did i something wrong? I followed all standard examples and it really is standard simple code. So.. help? :S

    BTW I am using;
    aspectjrt.jar (both from the latest build (104))

  • #2
    I had the same problem too.

    After reading the source code, I found that I have to specify the attribute propagation, isolation, timeout, and read-only inside the tx:method tag(s). Once I do that, the problem is gone.

    It seems to me that spring doesn't fill up the unspecified attributes with the default values.

    Anyway, hope this will help you.