0 Replies Latest reply on Apr 23, 2002 8:36 AM by ditto

    java.net.SocketException coming in JBoss-2.4.4 but not in WA

    ditto Newbie

      hi guys,
      I'm getting an exception like this while i'm executing a servlet.For better insight i attached the code also.

      java.net.SocketException: Connection aborted by peer: socket write error.

      Note:In WAS 3.5.2 it is executing in a very nice manner.

      The servlet code:

      public class InternalPriceSheetPDF extends HttpServlet {
      private static final String CONTENT_TYPE = "application/pdf";

      /**Initialize global variables*/
      public void init() throws ServletException {
      }
      /**Process the HTTP Get request*/
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      HttpSession session = null;
      try {
      response.setContentType(CONTENT_TYPE);
      response.setHeader("Pragma", "No-cache");
      response.setHeader("Cache-Control", "no-cache");
      response.setDateHeader("Expires", -1);
      System.out.println("The Buffer Size is :"+ response.getBufferSize());
      //System.out.println("The Buffer Size is :"+ response.getBufferSize());
      session = request.getSession();
      PartyManagement partyManagement = (PartyManagement)session.getAttribute("partyManagement");
      String loginURL = com.jbakr.cosi.Utils.getPropertyValue("loginURL");
      String returnURL = com.jbakr.cosi.Utils.getPropertyValue("ReturnURL");
      if(partyManagement == null) {
      response.sendRedirect(response.encodeRedirectURL(loginURL+"?ReturnUrl="+returnU RL));
      return;
      }
      else{
      String productLine = (String)session.getAttribute("productLine");
      SelecCon SelecCon = (SelecCon)session.getAttribute(productLine);
      Product product = SelecCon.getProduct();
      if(!product.isCompatible()) {
      response.sendRedirect(response.encodeRedirectURL("noCompatibleProduct.htm"));
      } else {
      File xmlFile = SelecCon.getConfigXML(partyManagement);
      XSLTInputHandler input = new XSLTInputHandler(xmlFile, new File(com.jbakr.cosi.Utils.getPropertyValue("fileLocation")+partyManagement.getX SLApp()+"internal-price-sheet-pdf.xsl"));
      renderXML(input, response);
      }
      }
      } catch (Exception e) {
      //session.setAttribute("appError" , e);
      //response.sendRedirect(response.encodeRedirectURL("appError.jsp"));
      e.printStackTrace();
      }
      }
      /**Process the HTTP Post request*/
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      doGet(request, response);
      }
      public void renderXML(XSLTInputHandler input,
      HttpServletResponse response) throws Exception {
      response.setBufferSize(131072);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Driver driver = new Driver();
      driver.setRenderer(Driver.RENDER_PDF);
      driver.setOutputStream(out);
      driver.render(input.getParser(), input.getInputSource());
      byte[] content = out.toByteArray();
      response.setContentLength(content.length);
      response.getOutputStream().write(content);
      response.getOutputStream().flush();
      }
      /**Clean up resources*/
      public void destroy() {
      }
      }

      Any help appreciated.
      Thanks,
      Ditto.