axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Suriarachchi" <amilasuriarach...@gmail.com>
Subject Re: Error after modifying the FWWEBServiceSkeleton.java
Date Tue, 02 Oct 2007 05:04:29 GMT
[ERROR] Servlet.service() for servlet jsp threw exception

*java.lang.IllegalStateException*: getOutputStream() has already been called
for this response
      at org.apache.catalina.connector.Response.getWriter(*Response.java:601

*this seems your request some how redirect to a jsp page.
where it try to access the writer. in a servlet either you can access a
outputstream or
writer.

Amila.
*

*
On 10/1/07, Golam Chowdhury <Golam.Chowdhury@fieldworker.com> wrote:
>
>  Hi,
>
>
>
>
>
> Code modified:
>
>
>
> /**
>
>      * Auto generated method signature
>
>      * *@param* getHistoryData1
>
>      */
>
>     *public* com.fw.webservice.GetHistoryDataResponse getHistoryData(
>
>         com.fw.webservice.GetHistoryData getHistoryData1)
>
>         *throws* SQLExceptionException0 {
>
>
>
>       GetHistoryDataResponse response = *new* GetHistoryDataResponse();
>
>       *try*{
>
>
>
>
>
>
>
>             Statement st = *null*;
>
>             ResultSet rs = *null*;
>
>             Statement st2 = *null*;
>
>             ResultSet rs2 = *null*;
>
>
>
>             //connect to database
>
>             Connection con = DatabaseConnection.*getConnection*();
>
>
>
>               //query the user table
>
>             String query = *null*;
>
>
>
>             CustomerHasAccess cs = *new* CustomerHasAccess();
>
>             cs.setFleetId(getHistoryData1.getFleetId());
>
>             CustomerHasAccessResponse cres =
> (CustomerHasAccessResponse)customerHasAccess(cs);
>
>                   *if*(cres.get_return()){
>
>
>
>
>
>                               //get number of data
>
> query = "SELECT count(distinct v.vehicle_id, vf.fleet_id, a.Latitude,
> a.Longitude, a.LogDateTime) as numdata FROM  vehicle_fleets vf,  vehicles
> v where  vf.vehicle_id = "+getHistoryData1.getVehicleId()+" and
> vf.fleet_id = "+getHistoryData1.getFleetId()+" and   v.vehicle_id =
> vf.vehicle_id  and   a.LogDateTime like '"+getHistoryData1.getEndTime()+"%'
> and   a.Creation_DateTime like '"+getHistoryData1.getStartTime()+"%'";
>
>                             st = con.createStatement();
>
>                                 rs = st.executeQuery(query);
>
>
>
>                             *int* size = 0;
>
>                             *int* index = 0;
>
>
>
>                             *while*(rs.next()){
>
>                               size = rs.getInt("numdata");
>
>                             }
>
>
>
>                             System.*out*.println("GetHistoryData number of
> data: "+size);
>
>
>
>                             *if*(getHistoryData1.getVehicleId()!=*null*){
>
>                                     query = "SELECT * FROM  vehicle_fleets
> vf,  vehicles v where  vf.vehicle_id = "+getHistoryData1.getVehicleId()+"
> and   vf.fleet_id = "+getHistoryData1.getFleetId()+" and   v.vehicle_id =
> vf.vehicle_id  and a.LogDateTime like '"+getHistoryData1.getEndTime()+"%'
> and   a.Creation_DateTime like '"+getHistoryData1.getStartTime()+"%'";
>
>                               }
>
>
>
>                                st2 = con.createStatement();
>
>                                  rs2 = st2.executeQuery(query);
>
>                                  Customer customer = *new* Customer();
>
>                                  customer.setId("100");
>
>                                  Fleet fleet = *new* Fleet();
>
>                                  fleet.setId(getHistoryData1.getFleetId
> ());
>
>                                  Vehicle vehicle = *new* Vehicle();
>
>                                  vehicle.setId(
> getHistoryData1.getVehicleId());
>
>                                  Data [] data = *new* Data[size];
>
>
>
>                                  *while*(rs2.next()){
>
>
>
>                                      *if*(getHistoryData1.getVehicleId()!=
> *null*){
>
>                                            data[index].setLat(
> rs2.getString("Latitude"));
>
>
>
>                                            data[index].setLon(
> rs2.getString("Longitude"));
>
>
>
>
>
>                                            data[index].setTime(
> rs2.getString("LogDateTime"));
>
>
>
>
>
>
>
>
>              }
>
>
>
>                                      index++;
>
>
>
>                                  }
>
>
>
>                                  vehicle.setData(data);
>
>
>
>
>
>                                 fleet.setVehicle(vehicle);
>
>
>
>                                  customer.setFleet(fleet);
>
>
>
>
>
>
>
>                                 response.set_return(customer);
>
>
>
>                               *return* response;
>
>             }*else*{
>
>                   *return* *null*;
>
>             }
>
>
>
>       }*catch*(SQLException ex){
>
>             System.*out*.println("getHistoryData Web Services:");
>
>             ex.printStackTrace();
>
>       }
>
>
>
>       *return* *null*;
>
>
>
>     }
>
>
>
> Any idea why I am getting this error?
>
>
>
> Thanks
>
>
>
> error:
>
> *java.lang.NullPointerException*
>
>       at com.fw.webservice.FWWEBServiceMessageReceiverInOut.toEnvelope(*
> FWWEBServiceMessageReceiverInOut.java:387*)
>
>       at
> com.fw.webservice.FWWEBServiceMessageReceiverInOut.invokeBusinessLogic(*
> FWWEBServiceMessageReceiverInOut.java:52*)
>
>       at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic
> (*AbstractInOutSyncMessageReceiver.java:42*)
>
>       at org.apache.axis2.receivers.AbstractMessageReceiver.receive(*
> AbstractMessageReceiver.java:96*)
>
>       at org.apache.axis2.engine.AxisEngine.receive(*AxisEngine.java:145*)
>
>       at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(*
> RESTUtil.java:125*)
>
>       at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(*
> RESTUtil.java:119*)
>
>       at
> org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest
> (*AxisServlet.java:799*)
>
>       at org.apache.axis2.transport.http.AxisServlet.doGet(*
> AxisServlet.java:242*)
>
>       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:269*)
>
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(*
> ApplicationFilterChain.java:188*)
>
>       at org.apache.catalina.core.StandardWrapperValve.invoke(*
> StandardWrapperValve.java:210*)
>
>       at org.apache.catalina.core.StandardContextValve.invoke(*
> StandardContextValve.java:174*)
>
>       at org.apache.catalina.core.StandardHostValve.invoke(*
> StandardHostValve.java:127*)
>
>       at org.apache.catalina.valves.ErrorReportValve.invoke(*
> ErrorReportValve.java:117*)
>
>       at org.apache.catalina.core.StandardEngineValve.invoke(*
> StandardEngineValve.java:108*)
>
>       at org.apache.catalina.connector.CoyoteAdapter.service(*
> CoyoteAdapter.java:151*)
>
>       at org.apache.coyote.http11.Http11Processor.process(*
> Http11Processor.java:870*)
>
>       at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (*Http11BaseProtocol.java:665*)
>
>       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(*
> PoolTcpEndpoint.java:528*)
>
>       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(*
> LeaderFollowerWorkerThread.java:81*)
>
>       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(*
> ThreadPool.java:685*)
>
>       at java.lang.Thread.run(Unknown Source)
>
> [ERROR] Servlet.service() for servlet AxisServlet threw exception
>
> *java.lang.NullPointerException*
>
>       at org.apache.axis2.transport.http.ApplicationXMLFormatter.writeTo(*
> ApplicationXMLFormatter.java:110*)
>
>       at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream
> (*CommonsHTTPTransportSender.java:294*)
>
>       at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke
> (*CommonsHTTPTransportSender.java:211*)
>
>       at org.apache.axis2.engine.AxisEngine.send(*AxisEngine.java:396*)
>
>       at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic
> (*AbstractInOutSyncMessageReceiver.java:45*)
>
>       at org.apache.axis2.receivers.AbstractMessageReceiver.receive(*
> AbstractMessageReceiver.java:96*)
>
>       at org.apache.axis2.engine.AxisEngine.receive(*AxisEngine.java:145*)
>
>       at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(*
> RESTUtil.java:125*)
>
>       at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(*
> RESTUtil.java:119*)
>
>       at
> org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest
> (*AxisServlet.java:799*)
>
>       at org.apache.axis2.transport.http.AxisServlet.doGet(*
> AxisServlet.java:242*)
>
>       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:269*)
>
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(*
> ApplicationFilterChain.java:188*)
>
>       at org.apache.catalina.core.StandardWrapperValve.invoke(*
> StandardWrapperValve.java:210*)
>
>       at org.apache.catalina.core.StandardContextValve.invoke(*
> StandardContextValve.java:174*)
>
>       at org.apache.catalina.core.StandardHostValve.invoke(*
> StandardHostValve.java:127*)
>
>       at org.apache.catalina.valves.ErrorReportValve.invoke(*
> ErrorReportValve.java:117*)
>
>       at org.apache.catalina.core.StandardEngineValve.invoke(*
> StandardEngineValve.java:108*)
>
>       at org.apache.catalina.connector.CoyoteAdapter.service(*
> CoyoteAdapter.java:151*)
>
>       at org.apache.coyote.http11.Http11Processor.process(*
> Http11Processor.java:870*)
>
>       at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (*Http11BaseProtocol.java:665*)
>
>       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(*
> PoolTcpEndpoint.java:528*)
>
>       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(*
> LeaderFollowerWorkerThread.java:81*)
>
>       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(*
> ThreadPool.java:685*)
>
>       at java.lang.Thread.run(Unknown Source)
>
> [ERROR] Servlet.service() for servlet jsp threw exception
>
> *java.lang.IllegalStateException*: getOutputStream() has already been
> called for this response
>
>       at org.apache.catalina.connector.Response.getWriter(*Response.java
> :601*
> ...
>
> [Message clipped]




-- 
Amila Suriarachchi,
WSO2 Inc.

Mime
View raw message