包含Spring MutableValues的NoSuchMethodError [英] NoSuchMethodError with Spring MutableValues

查看:54
本文介绍了包含Spring MutableValues的NoSuchMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个测试,其中使用注释指定了我的应用程序上下文位置。 然后,我自动将我的道装进测试中。

@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());                                

  }                                                                       
});                                                                         


}

当我运行测试时,我得到一个异常,指出无法加载应用程序上下文,它可以归结为:

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

我不知道从哪里开始查找,为什么会出现此错误,以及如何解决它? Info Sprringframework 3.0.2版本、Hibernate 3.4.0.GA、TestNG 5.9

谢谢!

推荐答案

该方法是在Spring3.0中添加的,因此您可能在类路径中的某个位置有一个早于3.0的Spring3.0版本。检查您的类路径。

这篇关于包含Spring MutableValues的NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆