Twitter4J throws exception java.lang.NoSuchMethodError: - java

unable to get twitter instance, please suggest which I have done mistake
Code :
String consumerKey = "************************";
//Your Twitter App's Consumer Secret
String consumerSecret = "********************";
//Your Twitter Access Token
String accessToken = "**********************************";
//Your Twitter Access Token Secret
String accessTokenSecret = "*****************************";
//Instantiate a re-usable and thread-safe factory
TwitterFactory twitterFactory = new TwitterFactory();
//Instantiate a new Twitter instance
Twitter twitter = twitterFactory.getInstance(); /// **problem comes over here**
twitter.setOAuthConsumer(consumerKey, consumerSecret);
twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));
while migrating from twitter v1 to v1.1
java.lang.NoSuchMethodError: twitter4j.TwitterFactory.getInstance(Ltwitter4j/auth/AccessToken;)Ltwitter4j/Twitter;
at com.verve.meetin.twitter.twitterAuthenticationServlet.doGet(twitterAuthenticationServlet.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
INFO-Inside user upcoming trips

I tried your code with the latest released version (3.0.3) and it compiled, and ran fine.
I think that you may have two different versions of Twitter4J on the class path, or that you are compiling with one version and running with another. One version will have the method and the other won't.
Note that TwitterFactory#getInstance(AccessToken), which is the missing method that the exception is reporting, was introduced in version 2.1.9 onwards.

Related

javax.xml.ws.WebServiceException: Undefined port type Java Struts SOAP WSDL

ok I have really a strange problem that I keep looking for solution in google and yahoo for almost 4 hours today. And I desperately looking for a solution.
public static String [] checkCardAccount(String cardNumber, String cardIssuer, String securityNumber){
URL url = null;
try {
url = new URL("http://localhost:8999/bankcard?wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
QName qname = new QName("http://server.bcard.soap.com/","BankCardImplService");
Service service = Service.create(url,qname);
BankCard bankcard = service.getPort(BankCard.class);
return bankcard.getCardClientData(cardNumber, cardIssuer);
}
the above code is my client for accessing the SOAP service, it really works in a standalone java application but when I embed it to my Java Struts application it says the following error below
javax.xml.ws.WebServiceException: Undefined port type:
{http://bankcard.api.com/}BankCard at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:349)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:355)
at javax.xml.ws.Service.getPort(Service.java:161) at
com.api.bankcard.BankCardClient.checkCardAccount(BankCardClient.java:25)
at com.action.CardregAction.execute(CardregAction.java:18) at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Now I really see that the problem is the target namespace because as I change it the error changes to that it says that the valid services is {http://bankcard.api.com/}BankCard
where I went wrong? this code works on standalone on Java Application but not in my Java Struts web app
give endpointIneterface in #WebService annotation in the implementation class, if you dont give endpoint interface, you have to mention fully qualified port name while using getPort method.
service.getPort("PortQName",BankCard.class);
You need to annotate the BankCardImpl class with #WebService(name="BankCard")
You can then use service.getPort(BankCard.class);
OR
If you just annotate it with #WebService or have given it another name, then you will need to provide more information to the getPort() method:
replace
BankCard bankcard = service.getPort(BankCard.class);
with
QName port_name = new QName("http://server.bcard.soap.com/","BankCardImplPort");
BankCard bankcard = service.getPort(port_name, BankCard.class);

IllegalStateException: null in HttpServlet.service

I'm simply trying to send back an error to the client when a request fails. Here's what my code looks like:
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
"Email and username are required fields.");
This code throws the following error:
java.lang.IllegalStateException: null
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407) ~[catalina-6.0.26.jar:6.0.26]
at com.****.****.****.*********Servlet.service(********Servlet.java:68) ~[********Servlet.class:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) ~[javaee-api-5.1.2.jar:5.1.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) ~[catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina-6.0.26.jar:6.0.26]
at org.red5.logging.LoggerContextFilter.doFilter(LoggerContextFilter.java:78) ~[red5.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) ~[catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) ~[catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina-6.0.26.jar:6.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) [catalina-6.0.26.jar:6.0.26]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) [tomcat-coyote-6.0.26.jar:6.0.26]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) [tomcat-coyote-6.0.26.jar:6.0.26]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote-6.0.26.jar:6.0.26]
Why is this being thrown here? I'm not doing anything before this call that has anything at all to do with the response object, I'm not even touching it until this error is sent in an if clause. Why am I getting this error?
The only reason for HttpServletResponse (implemented by ResponseFacade) to throw an IllegalStateException is that the response was already committed before. It must have been touched by someone before already.
If your ResponseFacade does not override response.sendError() or it leads to forwarding to the error page, it is happening because the response is getting committed before forwarding to the error page.
To resolve this issue,
make sure you are not flushing the response
If the response is committing automatically because the max buffer size has reached, try increasing the buffer size.

FilterChain throwing javax.servlet.ServletException: IteratedExpression.getItem: Index out of Bounds

Apologies for the lack of a code example but I'm not sure I could replicate the issue in a simple example.
The exception below has started to appear recently in my RichFaces application. It is a web front end for querying a database and display the data in a simple table. The problem occurs when my application finishes executing my code on the bean linked to a command button. It calls FilterChain.doFilter when you click the button on the pop panel, then completes the code on the bean, then i assume while trying to rerender the main window this exception is thrown.
The problem appeared when a new entry point to this same popup panel that performs the same code on the bean when the button is clicked that works fine, however since this new entry point was added the old one has started throwing this exception.
I know it's unlikely anyone will be able to provide an answer to the problem without code but having little understanding of how these filter chains work, I am not even sure where to start looking and was wondering if anyone could point me in a direction that might lead me to finding a solution.
The service is running on WASCE 2.1.
Any help will be greatly appreciated.
javax.servlet.ServletException: IteratedExpression.getItem: Index out of Bounds
at javax.faces.webapp._ErrorPageWriter.throwException(_ErrorPageWriter.java:549)
at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:293)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at myPackage.jsfutils.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at myPacakge.jsfutils.CheckLogonFilter.doFilter(CheckLogonFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:406)
at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.geronimo.tomcat.valve.ThreadCleanerValve.invoke(ThreadCleanerValve.java:40)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: IteratedExpression.getItem: Index out of Bounds
at javax.servlet.jsp.jstl.core.IteratedExpression.getItem(IteratedExpression.java:75)
at javax.servlet.jsp.jstl.core.IteratedValueExpression.getValue(IteratedValueExpression.java:60)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:64)
at org.apache.el.parser.AstValue.getValue(AstValue.java:112)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
at javax.faces.component.UIData.getValue(UIData.java:1081)
at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1624)
at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:65)
at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:59)
at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:120)
at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
at org.ajax4jsf.component.UIDataAdaptor.getRowIndex(UIDataAdaptor.java:311)
at javax.faces.component._ComponentUtils.idsAreEqual(_ComponentUtils.java:134)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:110)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:449)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:912)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findComponentFor(RendererUtils.java:882)
at org.ajax4jsf.context.AjaxContextImpl.convertId(AjaxContextImpl.java:395)
at org.ajax4jsf.context.AjaxContextImpl.addRegionsFromComponent(AjaxContextImpl.java:331)
at org.ajax4jsf.component.AjaxActionComponent.setupReRender(AjaxActionComponent.java:96)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:60)
at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:170)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastAjaxEvents(AjaxViewRoot.java:340)
at org.ajax4jsf.application.AjaxViewHandler.processAjaxEvents(AjaxViewHandler.java:216)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:169)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
... 29 more
2011-12-12 16:35:48,342 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.RuntimeException: IteratedExpression.getItem: Index out of Bounds
at javax.servlet.jsp.jstl.core.IteratedExpression.getItem(IteratedExpression.java:75)
at javax.servlet.jsp.jstl.core.IteratedValueExpression.getValue(IteratedValueExpression.java:60)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:64)
at org.apache.el.parser.AstValue.getValue(AstValue.java:112)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
at javax.faces.component.UIData.getValue(UIData.java:1081)
at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1624)
at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:65)
at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:59)
at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:120)
at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
at org.ajax4jsf.component.UIDataAdaptor.getRowIndex(UIDataAdaptor.java:311)
at javax.faces.component._ComponentUtils.idsAreEqual(_ComponentUtils.java:134)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:110)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component._ComponentUtils.findComponent(_ComponentUtils.java:107)
at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:449)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:912)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findUIComponentBelow(RendererUtils.java:919)
at org.ajax4jsf.renderkit.RendererUtils.findComponentFor(RendererUtils.java:882)
at org.ajax4jsf.context.AjaxContextImpl.convertId(AjaxContextImpl.java:395)
at org.ajax4jsf.context.AjaxContextImpl.addRegionsFromComponent(AjaxContextImpl.java:331)
at org.ajax4jsf.component.AjaxActionComponent.setupReRender(AjaxActionComponent.java:96)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:60)
at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:170)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastAjaxEvents(AjaxViewRoot.java:340)
at org.ajax4jsf.application.AjaxViewHandler.processAjaxEvents(AjaxViewHandler.java:216)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:169)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at myPackage.jsfutils.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at myPackage.jsfutils.CheckLogonFilter.doFilter(CheckLogonFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:406)
at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.geronimo.tomcat.valve.ThreadCleanerValve.invoke(ThreadCleanerValve.java:40)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Problem solved was trying to rerender part of the panel that didn't exist. Strange how it only happened on the one entry point was in the jsp as a rerender attribute on the confirm button on the popup panel so both entry points where using the same button and jsp declaration. Added in the part that was missing as it was meant to be there and can only imagine it was removed by mistake or an svn merge.
Look at the root cause:
java.lang.RuntimeException: IteratedExpression.getItem: Index out of Bounds
at javax.servlet.jsp.jstl.core.IteratedExpression.getItem(IteratedExpression.java:75)
at javax.servlet.jsp.jstl.core.IteratedValueExpression.getValue(IteratedValueExpression.java:60)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:64)
at org.apache.el.parser.AstValue.getValue(AstValue.java:112)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
at javax.faces.component.UIData.getValue(UIData.java:1081)
at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1624)
at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:65)
at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:59)
at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:120)
...
This is absolutely not related to filters. The request just happens to being passed through a filter. If the filter would have caused any problem, you would have seen it in the 1st line of the stacktrace.
Your concrete problem is most likely caused by not preserving the proper data model for the data table in the subsequent request. The managed bean is apparently in the request scope instead of the view scope. To fix this, you need to put the bean in the view scope and if necessary review your data model preserving/preloading logic. This should take place in (post)constructor and/or (action)listener methods, but for sure not in the getter method. The getter method should only return the data model, nothing more.
If you are still on JSF 1.x which doesn't have the new JSF 2.x view scope, you need to add an <a4j:keepAlive> to the page which references the request scoped managed bean.

Axis 2 generated code in "Expanded Mode"

I'm having some problems understanding how to send a request to a web service that I have deployed. I have followed the following tutorial:
http://wso2.org/library/1719
Which I have successfully applied, and it worked well. The tutorial was straightforward, and I have easily generated a web service client. All I did was creating "request" objects from the exposed web service method, set its arguments, and then using the web service stub, I have passed the request object to the exposed web service method, and got a response.
Now, I have received a WSDL file from which I'm supposed to build a web service client as well. The problem is that the generated files from the WSDL differ greatly from that of the tutorial I followed. I learned later on that when generating clients using ADB, there is a mode called "Expanded Mode" that generates " a class for each of the outer elements and the named complex types " (http://axis.apache.org/axis2/java/core/docs/adb/adb-howto.html#gen_modes). The problem is that I'm unable to understand how to create a request object and get a response from the web service from the generated classes. My best shot was as follows:
GetMfrInventoryProductItemsListE wrapper = new GetMfrInventoryProductItemsListE();
GetMfrInventoryProductItemsList request = new GetMfrInventoryProductItemsList();
request.setArg0(deviceId);
request.setArg1(macAddresses);
request.setArg2(mfrKey);
wrapper.setGetMfrInventoryProductItemsList(request);
GetMfrInventoryProductItemsListResponseE wrapperResponse = wmService.getMfrInventoryProductItemsList(wrapper);
GetMfrInventoryProductItemsListResponse response = wrapperResponse.getGetMfrInventoryProductItemsListResponse();
return response.get_return();
In the above code getGetMfrInventoryProductItemsList is the name of my exposed web service method, and wmService is my stub.
The result was the following stack Trace :
org.apache.axis2.AxisFault: Read timed out
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at wavemark.wmservice.soap.WMServiceStub.getMfrInventoryProductItemsList(WMServiceStub.java:3275)
at wavemark.linkserver.supplierconnect.controller.WsStub.getMfrInventoryProductItemsList(WsStub.java:107)
at wavemark.linkserver.supplierconnect.controller.WsManager.getProductItems(WsManager.java:384)
at wavemark.linkserver.supplierconnect.webservices.SupplierConnect.getProductItems(SupplierConnect.java:396)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
... 42 more
After trying to debug the problem, I have found out that this is the line that is throwing the exception:
GetMfrInventoryProductItemsListResponseE wrapperResponse = wmService.getMfrInventoryProductItemsList(wrapper);
I just want you guys to tell me if the way I'm using the request/response objects is correct.Your help is much appreciated.
Finally, I figured out how to solve the problem. Apparently the web service call that I was making, was taking a lot of time that it was timing out as the stack trace shows. So I added the following to my code to the section where I was instantiating my client stub:
wmService = new WMServiceStub();
Options options = new Options();
EndpointReference epr = new EndpointReference(url);
options.setTo(epr);
options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(300000));
wmService._getServiceClient().setOptions(options);
This results in increasing the Axis 2 web services' socket timeout to 5 minutes, which should be more than enough to most web service calls. I hope that this will be helpful for some developers out there.

Getting parameters values blank and null when using custom wsdl in axis2

I am using axis2 for my web services creation. I want to use my own wsdl file instead of using generated wsdl file. When I am placing my own wsdl file in META-INF directory and deploying my web services they are deploying successfully. But the problem is when i try to test these web service using soapui it throwing null pointer exception.
For example I am invoking following operations in soap ui.
public String testWebService(String a, String b)
{
LogHelper.info("Value of a is:"+a);
LogHelper.info("Value of b is :"+b);
String c=a.trim()+b.Trim();
return "suceess"
}
output in console:
value of a is:
value of b is:null
19:58:47,781 ERROR [RPCMessageReceiver] Exception occurred while trying to invoke service method testWebService
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at o......................................................
SO What i understand is i am getting value for a is blank and value of b is null.
Can any one give me any suggestions please.
Thanks,
Narendra

Categories