views:

606

answers:

1

Hello experts!

I have written a test where i specify my application context location with annotations. I then autowire my dao into the test.

@ContextConfiguration(locations = {"file:service/src/main/webapp/WEB-INF/applicationContext.xml"}) 
public class MyTest extends AbstractTestNGSpringContextTests {

@Autowired                                      
protected MyDao myDao;                        

private PlatformTransactionManager transactionManager;
private TransactionTemplate transactionTemplate;      


@Test                                   
public void shouldSaveEntityToDb() { 
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {        
    protected void doInTransactionWithoutResult(TransactionStatus status) { 

    Entity entity = new Entity();

    //test
    myDao.save(entity)

    //assert                                                            
    assertNotNull(entity.getId());                                

  }                                                                       
});                                                                         


}

When i run the test i get an exception which states that the application context could not be loaded and it boils down to:

    Caused by: java.lang.NoSuchMethodError:
    org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;

I have no idea where to start looking, why do i get this error and how can i resolve it? Info springframework 3.0.2.RELEASE, Hibernate 3.4.0.GA, testng 5.9

Thank you!

+1  A: 

This method was added in Spring 3.0, so you probably have a pre-3.0 Spring version somewhere in classpath. Check your classpath.

axtavt
You are correct, I had a dependency to spring 2.5.6 in my project.
jakob