我正在尝试使用抄写员进行Twitter授权。当我尝试

requestToken = service.getRequestToken()


我收到以下错误

14:10:11,305 ERROR [ajp-bio-8009-exec-4][IncludeTag:154]   java.lang.IllegalArgumentException: Cannot get String from a null object
    at org.scribe.utils.Preconditions.check(Preconditions.java:80)
    at org.scribe.utils.Preconditions.checkNotNull(Preconditions.java:27)
    at org.scribe.utils.StreamUtils.getStreamContents(StreamUtils.java:20)
    at org.scribe.model.Response.parseBodyContents(Response.java:40)
    at org.scribe.model.Response.getBody(Response.java:66)
    at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:59)
    at org.apache.jsp.html.portlet.login.login_jsp._jspService(login_jsp.java:2432)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)


我尝试了以下帖子中提到的答案,但没有任何效果

scribe + twitter > Cannot get String from a null object

每当我尝试包括TwitterApi.SSL.class或TwitterApi.Authenticate.class时,都会出现“无法解析为类型”错误。

有人遇到过这个问题吗?

最佳答案

使用.provider(TwitterApi.SSL.class)代替.provider(TwitterApi.class)。
它应该工作。

10-04 12:10