restful webservice中的Spring错误

时间:2018-02-08 16:34:34

标签: java spring rest

我正在使用Spring 3.0.7.RELEASE的旧版本,我就是这样 遇到下面的错误。转到Spring 3.1.1.RELEASE修复 问题。但是我现在无法转移到新版本。 我该怎么办?

为什么spring甚至会尝试调用该方法呢?

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.util.CollectionUtils.unmodifiableMultiValueMap(Lorg/springframework/util/MultiValueMap;)Lorg/springframework/util/MultiValueMap;
    at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:81)
    at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:280)
    at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:264)
    at org.springframework.web.util.UriTemplate.<init>(UriTemplate.java:70)
    at org.springframework.web.client.RestTemplate$HttpUrlTemplate.<init>(RestTemplate.java:653)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:407)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:385)
    at com.capitalone.cam.core.service.impl.AuthenticatorLevelsServiceImpl.retrieve(AuthenticatorLevelsServiceImpl.java:69)
    at com.capitalone.cam.core.service.impl.AuthenticatorLevelsServiceImpl.get(AuthenticatorLevelsServiceImpl.java:48)
    at com.capitalone.cam.core.dao.impl.AuthenticatorLevelsDAOImpl.loadAuthenticatorLevels(AuthenticatorLevelsDAOImpl.java:26)
    at com.capitalone.cam.core.dao.impl.AuthenticatorLevelsDAOImpl.get(AuthenticatorLevelsDAOImpl.java:22)
    at com.capitalone.cam.managers.impl.AuthenticationLevelManagerImpl.initialize(AuthenticationLevelManagerImpl.java:51)
    at com.capitalone.cam.core.client.CapabilitiesManagerAbstract.loadManagers(CapabilitiesManagerAbstract.java:96)
    at com.capitalone.cam.core.client.CapabilitiesManagerAbstract.initialize(CapabilitiesManagerAbstract.java:56)
    at com.capitalone.cam.client.sassy.main.CamTester.main(CamTester.java:178)

1 个答案:

答案 0 :(得分:3)

查看3.0.7Link)和3.1.1Link)的文档,您会注意到没有方法unmodifiableMultiValueMap 3.0.7

我的猜测是你正在使用具有不同版本号的Spring组件(.jar)。

具体而言HierarchicalUriComponents类(Link)自3.1.3

以来正式可用