Results 1 to 2 of 2
  1. #1
    jadeite100 is offline Member
    Join Date
    Dec 2009
    Posts
    13
    Rep Power
    0

    Default NoSuchMethodError javax.faces.application.StateManager.saveView(Ljav ax/faces/context

    Hi All:

    I needed your help!!
    Any hint or help will be greatly appreciated it.
    I am currently using Icefaces 1.8.2, JSF 1.1, JasperReports 4.5.1 and weblogic 10.3.2 I try to create a functionality when clicking an excel image it will try to get the result to an excel file using Jasper Report.
    I can compiled the following code. I try to use "saveView" but get the following error:

    Caused By: java.lang.NoSuchMethodError: javax.faces.application.StateManager.saveView(Ljav ax/faces/context/FacesContext;)Ljava/lang/Object;
    at com.cta.web.beans.OpportunitiesBean.downloadToExce l(OpportunitiesBean.java:321)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace
    >
    So from the following url(https://jira.springsource.org/browse/SWF-1112) it told me to use saveSerializedView I can compiled but when executed
    get the following error:


    23:38:22,002 ERROR ViewRootStateManagerImpl:145 - Exception finding JSF1.2 saveView method on delegate
    java.lang.NoSuchMethodException: org.apache.myfaces.application.jsp.JspStateManager Impl.saveView(javax.faces.context.FacesContext)
    at java.lang.Class.getMethod(Class.java:1605)
    at com.icesoft.faces.application.ViewRootStateManager Impl.initializeParameters(ViewRootStateManagerImpl .java:143)
    at com.icesoft.faces.application.ViewRootStateManager Impl.saveView(ViewRootStateManagerImpl.java:157)
    at com.icesoft.faces.application.ViewRootStateManager Impl.saveSerializedView(ViewRootStateManagerImpl.j ava:193)
    at com.cta.web.beans.OpportunitiesBean.downloadToExce l(OpportunitiesBean.java:322)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(AstValue.java:13 0)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpre ssionImpl.java:274)
    at com.sun.facelets.el.TagMethodExpression.invoke(Tag MethodExpression.java:68)
    at com.sun.facelets.el.LegacyMethodBinding.invoke(Leg acyMethodBinding.java:69)
    at javax.faces.component.UICommand.broadcast(UIComman d.java:89)
    at com.icesoft.faces.component.panelseries.UISeries$R owEvent.broadcast(UISeries.java:633)
    at com.icesoft.faces.component.panelseries.UISeries.b roadcast(UISeries.java:295)
    at com.icesoft.faces.component.paneltabset.PanelTabSe t.broadcast(PanelTabSet.java:318)
    at javax.faces.component.UIViewRoot._broadcastForPhas e(UIViewRoot.java:97)
    at javax.faces.component.UIViewRoot.processApplicatio n(UIViewRoot.java:171)
    at org.apache.myfaces.lifecycle.InvokeApplicationExec utor.execute(InvokeApplicationExecutor.java:32)
    at org.apache.myfaces.lifecycle.LifecycleImpl.execute Phase(LifecycleImpl.java:95)
    at org.apache.myfaces.lifecycle.LifecycleImpl.execute (LifecycleImpl.java:70)
    at com.icesoft.faces.webapp.http.core.JsfLifecycleExe cutor.apply(JsfLifecycleExecutor.java:50)
    at com.icesoft.faces.webapp.http.core.ReceiveSendUpda tes.renderCycle(ReceiveSendUpdates.java:171)
    at com.icesoft.faces.webapp.http.core.ReceiveSendUpda tes.service(ReceiveSendUpdates.java:112)
    at com.icesoft.faces.webapp.http.core.RequestVerifier .service(RequestVerifier.java:65)
    at com.icesoft.faces.webapp.http.servlet.BasicAdaptin gServlet.service(BasicAdaptingServlet.java:48)
    at com.icesoft.faces.webapp.http.servlet.SessionVerif ier.service(SessionVerifier.java:58)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:55)
    at com.icesoft.faces.webapp.http.servlet.SessionDispa tcher.service(SessionDispatcher.java:77)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:55)
    at com.icesoft.faces.webapp.http.servlet.MainServlet. service(MainServlet.java:192)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
    at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.s ervice(BlockingServlet.java:67)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(Tail Filter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at com.fedex.login.filter.WssoAuthenticationFilter.do Filter(WssoAuthenticationFilter.java:188)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3592)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :173)



    public String downloadToExcel(javax.faces.event.ActionEvent event)
    {
    InputStream reportStream = null;
    try
    {

    FacesContext context = FacesContext.getCurrentInstance();
    ExternalContext ext = context.getExternalContext();
    //reportStream = ext.getResourceAsStream("resources/jasper/PreviousBookings.jasper");
    reportStream = JRLoader.getResourceInputStream("resources/jasper/PreviousBookings.jasper");
    //JasperReport jasperReport = JasperCompileManager.compileReport(fis);
    Object[] previousBooking = new Object[newOpportunityByPreviousBookingDTOList.size()];
    int i = 0;
    for(NewOpportunityDTO previousBookingDTO:newOpportunityByPreviousBooking DTOList)
    {
    previousBooking[i] = previousBookingDTO;
    i++;
    }

    /*
    reportStream = JRLoader.getResourceInputStream("resources/jasper/PreviousBookings.jasper");
    JasperPrint jprint1 = JasperFillManager.fillReport(reportStream, new HashMap(), new JRBeanArrayDataSource(previousBooking));
    JRXlsxExporter exporterXLS = new JRXlsxExporter();
    exporterXLS.setParameter(JRXlsExporterParameter.JA SPER_PRINT, jprint1);
    exporterXLS.setParameter(JRXlsExporterParameter.OU TPUT_FILE_NAME, "c:/test1/test.xlsx");
    exporterXLS.exportReport();
    */
    JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, new HashMap(), new JRBeanArrayDataSource(previousBooking));
    HttpServletResponse resp = (HttpServletResponse) ext
    .getResponse();

    resp.setContentType("application/vnd.ms-excel");
    String filename = new StringBuffer("previousBookings").append(
    ".xls").toString();
    resp.setHeader("Content-Disposition", "inline;filename="
    + filename);

    JExcelApiExporter exporterXLS = new JExcelApiExporter();

    exporterXLS.setParameter(
    JRXlsExporterParameter.JASPER_PRINT,
    jasperPrint);
    exporterXLS.setParameter(
    JRXlsExporterParameter.IS_DETECT_CELL_TYPE,
    Boolean.TRUE);
    exporterXLS.setParameter(
    JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,
    Boolean.FALSE);
    exporterXLS.setParameter(
    JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWE EN_ROWS,
    Boolean.TRUE);
    exporterXLS.setParameter(
    JRXlsExporterParameter
    .IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS,
    Boolean.TRUE);
    exporterXLS.setParameter(
    JRXlsExporterParameter.IS_IGNORE_CELL_BORDER,
    Boolean.TRUE);
    exporterXLS.setParameter(JRXlsExporterParameter.OU TPUT_STREAM,
    resp.getOutputStream());
    exporterXLS.exportReport();
    //byte[] reportPDF = JasperRunManager.runReportToPdf(reportStream, parameterMap, connection);

    //context.getApplication().getStateManager().saveVie w(context);
    context.getApplication().getStateManager().saveSer ializedView(context);
    ServletOutputStream out;
    out = resp.getOutputStream();

    BufferedOutputStream bos = new BufferedOutputStream(out);
    bos.flush();
    bos.close();

    context.responseComplete();

    }
    catch(Exception e)
    {
    Utility.setTab(AirFreightConstants.AIRFREIGHT_OPPO RTUNITIES);
    log.error(StringUtil.exceptionToString(e));
    setErrorMessage("operation.failed.error.message", "Error Detail:"+StringUtil.exceptionToString(e));
    return null;
    }
    return "success";
    }

    JasperReport.jxml:
    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <style name="table">
    <box>
    <pen lineWidth="1.0" lineColor="#000000"/>
    </box>
    </style>
    <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
    <box>
    <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
    </style>
    <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
    <box>
    <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
    </style>
    <style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
    <box>
    <pen lineWidth="0.5" lineColor="#000000"/>
    </box>
    </style>
    <subDataset name="Table Dataset 1"/>
    <subDataset name="Table Dataset 2"/>
    <field name="awb" class="java.lang.String"/>
    <field name="departureDate" class="java.lang.String"/>
    <field name="destination" class="java.lang.String"/>
    <field name="statusDescription" class="java.lang.String"/>
    <field name="owner" class="java.lang.String"/>
    <field name="comments" class="java.lang.String"/>
    <field name="flight" class="java.lang.String"/>
    <background>
    <band splitType="Stretch"/>
    </background>
    <title>
    <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
    <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
    <band height="61" splitType="Stretch">
    <staticText>
    <reportElement x="6" y="28" width="80" height="30"/>
    <textElement/>
    <text><![CDATA[Departure Date]]></text>
    </staticText>
    <staticText>
    <reportElement x="91" y="28" width="50" height="30"/>
    <textElement/>
    <text><![CDATA[AWB]]></text>
    </staticText>
    <staticText>
    <reportElement x="215" y="28" width="100" height="30"/>
    <textElement/>
    <text><![CDATA[Destination]]></text>
    </staticText>
    <staticText>
    <reportElement x="330" y="28" width="73" height="30"/>
    <textElement/>
    <text><![CDATA[Status]]></text>
    </staticText>
    <staticText>
    <reportElement x="417" y="28" width="54" height="30"/>
    <textElement/>
    <text><![CDATA[Owner]]></text>
    </staticText>
    <staticText>
    <reportElement x="481" y="28" width="73" height="30"/>
    <textElement/>
    <text><![CDATA[Comments]]></text>
    </staticText>
    <staticText>
    <reportElement x="145" y="28" width="50" height="30"/>
    <textElement/>
    <text><![CDATA[Flight]]></text>
    </staticText>
    </band>
    </columnHeader>
    <detail>
    <band height="125" splitType="Stretch">
    <textField>
    <reportElement x="7" y="13" width="70" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{departureDate}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="92" y="13" width="50" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{awb}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="145" y="15" width="50" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{flight}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="211" y="17" width="100" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{destination}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="332" y="13" width="72" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{statusDescription}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="418" y="15" width="54" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{owner}]]></textFieldExpression>
    </textField>
    <textField>
    <reportElement x="482" y="13" width="100" height="30"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{comments}]]></textFieldExpression>
    </textField>
    </band>
    <band height="50"/>
    <band height="50"/>
    <band height="50"/>
    <band height="50"/>
    </detail>
    <columnFooter>
    <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
    <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
    <band height="42" splitType="Stretch"/>
    </summary>
    </jasperReport>

  2. #2
    nicephotog is offline Member
    Join Date
    Mar 2012
    Posts
    41
    Rep Power
    0

    Default Re: NoSuchMethodError javax.faces.application.StateManager.saveView(Ljav ax/faces/co

    downloadToExcel(OpportunitiesBean.java:321) and at java.lang.Class.getMethod(Class.java:1605)


    It should be written in "bean" method syntax.

    public String getDownloadToExcel(){.....}

    Which for the point of it would be better
    public StringBuffer getDownloadToExcel(){.....}

Similar Threads

  1. javax.faces.FacesException: Error decode resource data
    By murali23krishna in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 11-05-2011, 08:30 AM
  2. javax.faces.viewstate
    By mohan_praneeth in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 11-03-2009, 01:52 PM
  3. com.sun.faces.application.ApplicationAssociate
    By alam99 in forum JavaServer Faces (JSF)
    Replies: 5
    Last Post: 03-18-2009, 09:58 AM
  4. javax.faces.el.EvaluationException
    By xtech in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 04-10-2008, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •