Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError with Spring MutableValues

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!

like image 408
jakob Avatar asked Apr 16 '10 15:04

jakob


1 Answers

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

like image 70
axtavt Avatar answered Sep 20 '22 15:09

axtavt