Announcement Announcement Module
Collapse
No announcement yet.
NoSuchMethodError: JpaTransactionManager.determineTimeout Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchMethodError: JpaTransactionManager.determineTimeout

    I'm using 2.5.4 of all the Spring components. I'm just stuck. I have no idea why I'm getting this ...


    Code:
    org.springframework.orm.jpa.JpaTransactionManager.determineTimeout(Lorg/springframework/transaction/TransactionDefinition;)I
    
    java.lang.NoSuchMethodError: org.springframework.orm.jpa.JpaTransactionManager.determineTimeout(Lorg/springframework/transaction/TransactionDefinition;)I
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:334)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:315)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:257)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy24.saveOrUpdateAddress(Unknown Source)
    at com.wdig.wdyp.HibernateTest.addressDaoTest(Unknown Source)

    Code:
            <bean id="addressDao" class="com.wdig.wdyp.dao.jpa.JpaAddressDao"/>
    
    	<bean id="wdypDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
    		<property name="jndiName" value="wdypDataSource" />
    		<property name="resourceRef" value="true" />	
    	</bean>
    
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                    <property name="dataSource" ref="wdypDataSource"/>
    	        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    	</bean>
    
            <tx:annotation-driven/>
    
            <aop:config>
                <aop:pointcut id="daoMethods" expression="execution(* com.wdig.wdyp.dao.*.*(..))"/>
                <aop:advisor advice-ref="txAdvice" pointcut-ref="daoMethods"/>
            </aop:config>
            
            <tx:advice id="txAdvice" transaction-manager="transactionManager">
                <tx:attributes>
                    <tx:method name="*" propagation="REQUIRED"/>
                </tx:attributes>
            </tx:advice>
            
            
            <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                <property name="dataSource" ref="wdypDataSource"/>
                <property name="persistenceXmlLocation" value="persistence-test.xml"/>
            </bean>
            
            <bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
            <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
            <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

    -Steve Maring

  • #2
    Hi Steve,

    Did you manage to solve this problem?

    I'm having a similar problem when running a testcase using Spring JPA.

    I have the following setup: Spring 2.5.6, Hibernate 3.4.0.GA

    I'm using the persistentContext annotation so I get an EntityManager injected and not the EntityManagerFactory (using the @PersistenceUnit annotation)

    I'm getting the same exception thrown as Steve.... I'd really appreciate some help with this.

    thanks
    Paul


    applicationContext-test.xml
    Code:
    	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
    		p:dataSource-ref="testDataSource" 
                    p:persistenceUnitManager-ref="persistenceUnitManager"
                    p:persistenceUnitName="testPersistenceUnit"
    		p:jpaVendorAdapter-ref="jpaAdapter">
    	</bean>
    
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
    		p:entityManagerFactory-ref="entityManagerFactory"/> 
    
             <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
    		p:databasePlatform="org.hibernate.dialect.HSQLDialect"
    		p:generateDdl="true"
    		p:showSql="true" />
    		
            <bean id="persistenceUnitManager"
    class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"
                    p:persistenceXmlLocation="classpath:persistence-test.xml"
    		p:dataSources-ref="dataSources" />		
    
    	<util:map id="dataSources">
    		<entry key="testDataSource" value-ref="testDataSource" />
    	</util:map>
    
        <bean id="testDataSource"
            class="org.apache.commons.dbcp.BasicDataSource"
            destroy-method="close"
            p:driverClassName="org.hsqldb.jdbcDriver"
            p:url="jdbc:hsqldb:mem:duplicates"
            p:username="sa"
            p:password="" />
    persistence-test.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
    	xmlns:schemaLocation="http://java.sun.com/xml/ns/persistence 
    	http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    
        <persistence-unit name="testPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        	
        	<jta-data-source>testDataSource</jta-data-source>
    	<class>model.Statement</class>
        </persistence-unit>		     
    </persistence>
    my testcase
    Code:
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration (locations = { "classpath:applicationContext-test.xml"})
    @Transactional
    public class MisStatementDaoTest {
    	
        public EntityManager entityManager;
        
        @PersistenceContext
        public void setEntityManager(EntityManager entityManager) {
        	
        	this.entityManager = entityManager;
        }
        	
    	@Test
    	public void testPersist() {
    
    		Statement statement = getStatement();
    		
    		entityManager.persist(statement);
    	
    		assertEquals(1L, statement.getId());
    	}

    Comment

    Working...
    X