wood burning stoves 2.0*
The moose likes JSF and the fly likes Using HttpClient inside JSF action method. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Using HttpClient inside JSF action method." Watch "Using HttpClient inside JSF action method." New topic
Author

Using HttpClient inside JSF action method.

Andrzej Folga
Greenhorn

Joined: Dec 06, 2007
Posts: 5
Configuration: jboss 4.2.0 GA, MyFaces 1.5.0. I`m trying to call executeMethod(GetMethod) on my HttpClient class to receive xml file and then parse it using JAXB. The exception i`m recieving is:

11:36:12,859 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception javax.servlet.ServletException: Exception while invoking expression #{Task.save} at javax.faces.webapp.FacesServlet.service(FacesServlet.java:154) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.bluemedia.topupInvoice.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) 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)
My action method code is:

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Hint: Never write try clauses that throw away the exception.

Add the following code before the "finally: clause:



While I don't otherwise condone web apps printing to stdout, in Tomcat it will show up in one of the catalina output logs.

For a Real World app, I'd use proper logging and add error handling code to the app, but this will get you rolling.
[ December 06, 2007: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using HttpClient inside JSF action method.
 
Similar Threads
Exception in PhaseListener RESTORE_VIEW 1 afterPhase
Strange null exception on Tomcat 6.0.18
h:selectOneMenu PROBLEM
java.sql.BatchUpdateException: IO Error: Socket read timed out error
Problem Upload files on google docs through Liferay portal 6.0.6