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

  • tx:advise won't work

    Hello,

    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(Constants.java:142)
    	at org.springframework.core.Constants.asNumber(Constants.java:113)
    	at org.springframework.transaction.support.DefaultTransactionDefinition.setPropagationBehaviorName(DefaultTransactionDefinition.java:120)
    	at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.parseAttributes(TxAdviceBeanDefinitionParser.java:96)
    	at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.doParse(TxAdviceBeanDefinitionParser.java:77)
    This is the AOP part of the XML i'm using:

    HTML Code:
    	<!-- turn on autoproxy -->
    	<aop:aspectj-autoproxy/>
    	
    	<aop:config>
    		<aop:pointcut id="entryPoint" expression="execution(* com.nefli.camelot.logic.manager.*.*(..))"/>
            <aop:advisor advice-ref="txAdvice" pointcut-ref="entryPoint" /> 
    	</aop:config>
    
        <tx:advice id="txAdvice" transaction-manager="transactionManager">
            <tx:attributes>
                <tx:method name="get*" read-only="true" />
                <tx:method name="*" />
            </tx:attributes>
        </tx:advice>
        
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        	<property name="sessionFactory" ref="sessionFactory"/>
        </bean>
    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;
    spring-2.0-rc3-build104
    spring-aspects-2.0-rc3-build104
    aspectjrt.jar (both from the latest build (104))
    aspectjweaver.jar

  • #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.

    Thanks,

    Kenneth

    Comment

    Working...
    X