0 Replies Latest reply on Apr 1, 2014 1:37 AM by Manikandan M

    After Export jasper - Buttons are not showing.

    Manikandan M Newbie

      Hi,

       

      My project migrated from weblogic server to Jboss application server.

      I am using the JBOSS Application Server (jboss-as-7.1.1.Final)

       

      I developed jasper reports using (jasperreports-3.7.4.jar).

      Weblogic Server:

      In weblogic server is working fine (after the jasper reports showing the buttons (Print and Close)).

      JBOSS server:

      A report is showing good in Jboss server (Error in log - getOutputStream() has already been called for this response). after that Jasper report –Buttons are not showing .

      I need to show the Print and Close button.

       

       

      1. After reports How to show the buttons?
      2. How to fix the getOutputStream error?.

      pls. help me on this.

       

      Bellow my code:

       

      JSP Code

       

      <html>

      <body>

       

      <div id="jasper" style=" max-height: 500px">

           GmJasperReport gmJasperReport = new GmJasperReport();

           gmJasperReport.setRequest(request);

           gmJasperReport.setResponse(response);

           gmJasperReport.setJasperReportName(strJASNAme);

           gmJasperReport.setHmReportParameters(hmOrderDetails);

           gmJasperReport.setReportDataList(alHashMap);

           gmJasperReport.createJasperReport();   

       

      </div>

      <table align="center" width="100%">

      <tr>

             <td align="center" id="button">

      <input type="button" value="Print" class="Button" onclick="fnPrint();"/>

      <input type="button" value=" Close " name="Btn_Close" class="button" onClick="window.close();" >

             </td>

      </tr>

      </table>          

      </FORM>

      </BODY>

      </HTML>

       

      Java Class:

       

      public void createJasperReport() throws Exception {

              String strJasperPath = GmCommonClass.getString("GMJASPERLOCATION");

              JasperPrint jp = null;

              JRExporter exporter = null;

             

       

              InputStream reportStream;

              ServletOutputStream servletOutputStream = response.getOutputStream();

              reportStream = request.getSession().getServletContext().getResourceAsStream(strJasperPath + strJasperReportName);

              if (reportDataList != null) {

                  jp = JasperFillManager.fillReport(reportStream, hmReportParameters, new JRBeanCollectionDataSource(reportDataList));

              } else {

                  jp = JasperFillManager.fillReport(reportStream, hmReportParameters, new JREmptyDataSource());

              }

       

              jp.setPageHeight(intpageHeight);

             

              exporter = new JRHtmlExporter();

             

      exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);

      exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, servletOutputStream);

       

              request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jp);

      exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, new HashMap());

       

      exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, request.getContextPath() + "/GmImageServlet?time="+new java.util.Date().getTime()+"&image=");

              exporter.exportReport();

             

              servletOutputStream.close();

          }

         

       

      In Log error

       

      1. 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:614) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:199) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:188) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:117) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:76) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jsp.accounts.GmAccountActivityReportPrint_jsp._jspService(GmAccountActivityReportPrint_jsp.java:301)

          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]

          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:622) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:560) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:488) [jbossweb-7.0.13.Final.jar:]

          at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) [commons-chain-1.1.jar:1.1]

          at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) [commons-chain-1.1.jar:1.1]

          at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) [commons-chain-1.1.jar:1.1]

          at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) [struts-core-1.3.8.jar:1.3.8]

          at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) [struts-core-1.3.8.jar:1.3.8]

          at com.globus.common.servlets.GmStrutsActionServlet.doPost(Unknown Source) [classes:]

          at com.globus.common.servlets.GmStrutsActionServlet.doGet(Unknown Source) [classes:]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

          at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) [displaytag-1.1.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.13.Final.jar:]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

          at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) [jbossweb-7.0.13.Final.jar:]

          at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) [jbossweb-7.0.13.Final.jar:]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_43]

       

       

       

       

      Thanks & Regards,

      Mani