Use .provider(TwitterApi.SSL.class) instead .provider(TwitterApi.class). It should work.
Twitter + Scribe + Cannot get String from a null object
سؤال
I am trying to use scribe for authorization with twitter. When I try
requestToken = service.getRequestToken()
I get following error
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)
I tried the answer mentioned in following posts but nothing worked
scribe + twitter > Cannot get String from a null object
Whenever I am trying to include TwitterApi.SSL.class or TwitterApi.Authenticate.class, it is giving me "cannot be resolved to a type" error.
Did anybody experience this issue ?
لا يوجد حل صحيح
نصائح أخرى
Please check which Scribe version you are using. According to their ChangeLog page, SSL support was only added during version 1.2, so your jar will not contain the SSL class if it's from an older version. https://github.com/fernandezpablo85/scribe-java/blob/master/changelog.txt
Downloading the latest jar will solve your problem :)