Twitter + Scribe + Cannot get String from a null object - java

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 ?

Use .provider(TwitterApi.SSL.class) instead .provider(TwitterApi.class).
It should work.

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 :)

Related

Window execution create components zk version 9.0.1.2

While opening the window getting this error in version 9.0.1.2. And it's working fine in 8.5.0 version. After upgrading the version from 8.5.0 to 9.0.1.2 this error occurred.
window = (Window) Executions.createComponents(url, parent, params);
window.doModal();
java.lang.NumberFormatException: For input string: "auto"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at org.zkoss.zul.Grid.isVflex(Grid.java:420)
at org.zkoss.zkmax.zul.impl.LiveGridDataLoader.isCropper(LiveGridDataLoader.java:392)
at org.zkoss.zul.Grid.renderProperties(Grid.java:1791)
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2175)
at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:2266)
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2207)
at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:2266)
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2207)
at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:2266)
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2207)
at org.zkoss.zk.ui.AbstractComponent.redrawChildren(AbstractComponent.java:2266)
at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2207)
at org.zkoss.zk.ui.impl.UiVisualizer.redraw(UiVisualizer.java:1016)
at org.zkoss.zk.ui.impl.UiVisualizer.redrawComponents(UiVisualizer.java:1030)
at org.zkoss.zk.ui.impl.UiVisualizer.addResponsesForCreatedPerSiblings(UiVisualizer.java:882)
at org.zkoss.zk.ui.impl.UiVisualizer.getResponses(UiVisualizer.java:746)
at org.zkoss.zk.ui.impl.UiEngineImpl.getResponses(UiEngineImpl.java:1575)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1345)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:487)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:495)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
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 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
you forgot to ask a question that can be answered / solved.
The error can be explained by the source code of the isVflex method on grid itself (however that information might not help your actual problem, whatever that might be)
v8.5.0: https://github.com/zkoss/zk/blob/v8.5.0/zul/src/org/zkoss/zul/Grid.java#L399-L408
v9.0.1.2:
https://github.com/zkoss/zk/blob/v9.0.1.2/zul/src/org/zkoss/zul/Grid.java#L412-L421
The value 'auto' is not handled by this method, leading to this error.
If you provide a correct value (null, '', 'true', 'min' or a number) the error will go away.
The same exception should have happened in both versions 8.5.0 and 9.0.1.2 given the value 'auto'.
Unfortunately you didn't provide a working/failing example to investigate so I can't comment on that.

getOutputStream() has already been called for this response error

Exception :
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause :
java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.catalina.connector.Response.getWriter(Response.java:627)
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:215)
javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:105)
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190)
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:123)
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:80)
org.apache.jsp.DownloadResume_jsp._jspService(DownloadResume_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
I think I also got this error when I was working with jasper reports with Struts.
What happen was after creating the report I still returned a value(null) from the Action class(Servlet/Controller). The issue is, the report was set to the HTTPResponse and it is generated and I returned the response from the Action class again.
I just commented the return part from the Action class and then it worked.
Hope this will solve your issue.
Thanks.

Liferay 6.2 - Web Content > Add Translation shows blank popup

I have a problem with Liferay (liferay-portal-6.2-ce-ga2 installed on a Linux CentOS) :
I create a simple Web Content
I click on "Add translation" :
An empty (blank) popup shows up :
The StackTrace is :
[root#localhost liferay-portal-6.2-ce-ga2]# 16:11:40,280 ERROR [http-bio-8080-exec-5][IncludeTag:129] Current URL /group/control_panel/manage?p_p_auth=4sFFw6Rw&p_p_id=15&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&doAsGroupId=10197&refererPlid=11419&controlPanelCategory=sites&_15_groupId=10197&_15_struts_action=/journal/edit_article&_15_articleId=11555&_15_toLanguageId=en_GB&yui_patched_v3_11_0_1_1418400688901_2444=1418400720708 generates exception: 1
java.lang.ArrayIndexOutOfBoundsException: 1
at org.apache.jsp.html.portlet.journal.edit_005farticle_jsp._jspService(edit_005farticle_jsp.java:824)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:295)
at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:192)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:83)
at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:3141)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
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:728)
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:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
I found the edit_005farticle_jsp.java:824 but I can't understand what's causing the ArrayIndexOutOfBoundsException.
Install has been done and redone properly several times.
Every help would be very appreciated.
Thanks in advance.
OK, I found what was wrong : one of our hooks had an impact on this popup (causing the ArrayIndexOutOfBoundsException).
#Pawel : thanks for your concern anyway.

Is this a standard error from Apache Tomcat?

I'm receiving this error while accessing in the index page of my JSP project.
Sep 3, 2013 12:03:14 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/MyProject] threw exception [java.lang.NullPointerException] with root
cause
java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspService(index_jsp.java:126)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
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:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
I guess this is a "standard error" from TomCat but I can't find out what is the real problem.
It's a java.lang.NullPointerException in your JSP page, but I take it you'd figured that out already.
JSP pages are converted/compiled to Java - thus the (index_jsp.java:126) in the stacktrace - but unfortunately you can't use the line number for figuring out the problem as it doesn't relate to your JSP file, but the resulting Java source.
You should, however, be able to figure out where the NPE happens by inspection, since your JSP is of course a thin presentation layer, right :-) A usual mistake could be referencing attributes that aren't provided on entry to the page, eg. request.getParameter( "something" ).equals( "somethingelse" ) <-- possible NPE on .equals()
If you were to share the JSP page (perhaps in the form of an SSCCE), this community can help much better.
Cheers,
It's not a "Tomcat standard" error. Its an error in your source code. JSP is translated to java and java.lang.NullPointerException signifies that somewhere you are trying to use some variable without properly initializing it. Or you may have expected it to be initialized but it hasn't due to some resource being unavailable.
You CAN use the line number to find the error. (The answer by Anders R. Bystrup incorrectly says the opposite "...unfortunately you can't use the line number for figuring out the problem".)
It's true the JSP pages are converted to Java and thus the line number does not correspond to the line number in your JSP, but you can find the converted Java file in your work directory, somewhere like:
${TOMCAT_HOME}/work/Catalina/localhost/_/org/apache/jsp/index_jsp.java
and looking at the given line number (126) in that file should point you toward the problem in your JSP (there will likely be an identical line in your JSP).
As others have already pointed out, in this case you have an NPE.

Custom error page to handle Axis2Fault , EPR not found

I have created a new web service project which works fine, when trying to access using correct url i am able to view the wsdl on the browser.
But when a wrong url is typed stack trace is being shown on the browser as below :
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is //services/TestService?wsdlkdfl and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)
at org.apache.axis2.engine.Phase.invoke(Phase.java:329)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:837)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:273)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
how to handle this scenario to show a blank page rather than showing stack trace?
I was able to solve this issue by changes in axis2.xml file as below :
"sendStacktraceDetailsWithFaults" parameter to > false
"DrillDownToRootCauseForFaultReason" parameter to > false
Previously these two parameters were true, due to which whole of the stack trace was getting displayed.
Hope this helps for some one with same issue. I couldn't find much in the internet.

Categories

Resources