Map map = restTemplate.postForObject(buildUri(yqlQuery),request, LinkedHashMap.class);
Profile profile = restTemplate.postForObject(buildUri(yqlQuery),request, Profile.class);;
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String
org.springframework.social.yahoo.api.impl.YahooErrorHandler.handleClientErrors(YahooErrorHandler.java:50)
org.springframework.social.yahoo.api.impl.YahooErrorHandler.handleError(YahooErrorHandler.java:33)
org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:615)
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:573)
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:544)
org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:347)
org.springframework.social.yahoo.api.impl.ProfileTemplate.profile(ProfileTemplate.java:35)
org.springframework.social.yahoo.connect.YahooAdapter.setConnectionValues(YahooAdapter.java:30)
org.springframework.social.yahoo.connect.YahooAdapter.setConnectionValues(YahooAdapter.java:15)
org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:174)
org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:137)
org.springframework.social.connect.support.OAuth1Connection.<init>(OAuth1Connection.java:59)
org.springframework.social.connect.support.OAuth1ConnectionFactory.createConnection(OAuth1ConnectionFactory.java:59)
org.springframework.social.security.provider.OAuth1AuthenticationService.getAuthToken(OAuth1AuthenticationService.java:112)
org.springframework.social.security.SocialAuthenticationFilter.attemptAuthService(SocialAuthenticationFilter.java:239)
org.springframework.social.security.SocialAuthenticationFilter.attemptAuthentication(SocialAuthenticationFilter.java:157)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:211)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
public class ProfileTemplate extends AbstractOperations implements ProOps {
private final RestTemplate restTemplate;
@Override
public Profile profile() throws JsonParseException, JsonMappingException, IOException,UnsupportedEncodingException {
MultiValueMap<String, String> request = new LinkedMultiValueMap<String, String>();
request.set("format","json");
String yqlQuery = UriUtils.encodePath("...", "UTF-8");
Map map = restTemplate.postForObject(buildUri(yqlQuery),request, LinkedHashMap.class);
Profile profile = objectMapper().convertValue(map.get("profile"), Profile.class);
return profile;
}
}
这个问题与YahooErrorHandler.java:50上的转换有关
应该使用toString()而不是直接强制转换以下行:
errorText = (String) errorMap.get("error");
正确:
errorText = errorMap.get("error").toString();
在我的应用程序中,我为gcm ccs(xmpp)运行这些代码,代码显示以下错误执行时出错,这是代码:
我正试图通过登录从报头中发送的API密钥对一个用户进行身份验证,而没有任何用户详细信息。然后,我会得到一个转换异常,因为我试图将主体转换为字符串。
我在将2d数组传递给另一个活动时遇到了Android问题。我没有问题通过额外的作为可序列化发送它。但是在收到它时,我得到以下错误: E/AndroidRuntime(7396): 由以下原因引起: java.lang.ClassCastException: java.lang.Object[] 不能被强制转换为 java.lang.String[][] 我使用以下代码: 有人可以帮我解决这个问题吗
在tomcat上运行web应用程序时,我收到以下stacktrace错误,无法找到此异常的根本原因。
有人知道怎么解决这个问题吗?
我有一个用于listview的自定义适配器,它接收自定义对象“CustomObj”的数组并将其显示在listview中, 尝试使用AdapterView.OnItemClickListener: