[HELP] NoSuchReportComponentInViewException

Help
2011-11-09
2014-09-11
  • Ale Iruleguy

    Ale Iruleguy - 2011-11-09

    Peeps,

    I'm brand new to the JSF & JasperReports stuff, so pardon my newbieness. I've
    been trying to integrate a few reports created through iReport to my JSF app.
    Problem is that either using

    <jr:reportFrame>
    

    or

    <jr:reportLink>
    

    I get an exception (see stack trace for details).

    Any help appreciated. :]

    Stack trace:

    #|2011-11-09T17:20:18.527-0200|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=129;_ThreadName=Thread-2;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
    net.sf.jasperreports.jsf.lifecycle.NoSuchReportComponentInViewException: j_idt3
        at net.sf.jasperreports.jsf.lifecycle.RenderResponsePhaseListener.beforePhase(RenderResponsePhaseListener.java:108)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:722)
    |#
    
     
  • Ale Iruleguy

    Ale Iruleguy - 2011-11-09

    Forgot to mention this is the way I'm trying to render the report in:

    <jr:reportFrame value="/reports/SomeReport.jasper" format="pdf">
            ...
    </jr:reportFrame>
    

    It's reeeally simple, though I'm at a loss.

     
  • Alonso Dominguez

    Hi airuleguy,

    did you tried to sorround the report component inside a <h:form> ? The plugin
    needs this to be able to store the tree view state and restore it when the
    report is rendered.

    Regards,
    Alonso

     
  • Ale Iruleguy

    Ale Iruleguy - 2011-11-10

    Alonso,

    it worked like a charm. Good-bye NoSuchComponentInViewException. Now I'm
    having some other issues, but I'll try to figure them out on my own before
    asking.

    Thanks a bunch ;)

    Alex

     
  • Ale Iruleguy

    Ale Iruleguy - 2011-11-11

    Okay, next question: are any other libraries required to get the plugin
    working?
    Aside from the ones that are included in:

    jasperreports-jsfplugin-1.0-beta-4
    

    Because the jasperreports projects has around 48 libraries, and I'm not sure
    whether I need any of them.

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-11-11

    If you're using maven all you need is

    <dependency>
        <groupId>net.sf.jasperreports.jsf</groupId>
        <artifactId>jasperreports-jsf</artifactId>
        <version>1.0-beta-4</version>
    </dependency>
    
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2</version>
    </dependency>
    
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy</artifactId>
        <version>1.8.2</version>
    </dependency>
    

    If you're using Ant, just include the JAR files bundled in JR-JSF archine.

    --
    Bahman

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-11-11

    Correcting a little typo:
    archine = archive

     
  • Ale Iruleguy

    Ale Iruleguy - 2011-11-13

    Thanks!
    I had to add

    groovy-all-1.7.5
    

    before I realised I could change the language before compiling the report.

    Last question, I'm trying to define a

    <jr:source>
    

    that uses a MySQL connection. However, I get a MissingAttributeException. (see
    stack trace for details).

    This is the way I'm doing it:

    <jr:source id="dirme2011"
                       value="jdbc:mysql://localhost:3306/mydatabase">
                <f:attribute name="driverClassName" value="com.mysql.jdbc.Driver" />
                <f:attribute name="username" value="usr" />
                <f:attribute name="password" value="pwd" />
            </jr:source>
    

    Stack trace:

    net.sf.jasperreports.jsf.validation.MissingAttributeException: Missing component attribute
        at net.sf.jasperreports.jsf.component.UISource.validate(UISource.java:377)
        at net.sf.jasperreports.jsf.component.UISource.executeValidate(UISource.java:403)
        at net.sf.jasperreports.jsf.component.UISource.processDecodes(UISource.java:334)
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase$1.invokeContextCallback(SourceConverterBase.java:130)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1392)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1403)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1403)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase.resolveSource(SourceConverterBase.java:127)
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase.convertFromValue(SourceConverterBase.java:91)
        at net.sf.jasperreports.jsf.component.UIReport.decodeSource(UIReport.java:463)
        at net.sf.jasperreports.jsf.component.UIReport.executeDecodes(UIReport.java:548)
        at net.sf.jasperreports.jsf.component.UIReport.processDecodes(UIReport.java:425)
        at net.sf.jasperreports.jsf.lifecycle.ApplyRequestValuesPhaseListener.invokeContextCallback(ApplyRequestValuesPhaseListener.java:35)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1392)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1403)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1403)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:669)
        at net.sf.jasperreports.jsf.lifecycle.InterPhaseListener.beforePhase(InterPhaseListener.java:48)
        at net.sf.jasperreports.jsf.lifecycle.ApplyRequestValuesPhaseListener.beforePhase(ApplyRequestValuesPhaseListener.java:26)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:722)
    
     
  • Alonso Dominguez

    You are missing the "type" attribute for the "<jr:source/>" tag. You should
    use:

    <jr:source id="dirme2011" type="jdbc" value="jdbc:mysql://localhost:3306/mydatabase">
        <f:attribute name="driverClassName" value="com.mysql.jdbc.Driver" />
        <f:attribute name="username" value="usr" />
        <f:attribute name="password" value="pwd" />
    </jr:source>
    

    Regards,
    Alonso

     
  • Izaak van Niekerk

    Hi there,
    I am also getting the Exception:

    net.sf.jasperreports.jsf.lifecycle.NoSuchReportComponentInViewException:
    report:myReportFrame

    However I am actually using the component inside a h:form tag:

    <h:form id="report">
    <jr:source id="transactionSource" type="jdbc" value="jdbc:oracle:thin:@192.168.10.152:1521:dev2">
    <f:attribute name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <f:attribute name="username" value="username"/>
    <f:attribute name="password" value="password"/>
    </jr:source>
    <jr:reportFrame id="myReportFrame" source="transactionSource" value="/reports/Transactions.jasper" format="pdf" height="400px" width="80%"/>
    </h:form>

    I am using JSF 2.0 and I did not add anything to my web.xml.
    Instead of using Transactions.jasper I have also tried using the
    Transactions.jrxml file but without any luck.

    I am including the following files/jars in my lib folder:
    bcmail-jdk14-1.38.jar
    bcprov-jdk14-1.38.jar
    commons-beanutils
    commons-collections
    commons-digester
    commons-io
    itext
    jasperreports-3.7.1
    jasperreports-jsf-1.0-beta-4.jar
    jxl
    xml-apis

    please help, I have tried several things and keep on getting the same
    exception.

     
  • Alonso Dominguez

    Hi Izzak, can you post a snippet from your XHTML view to see how you are using the components?

    A stacktrace would help also

     
  • Izaak van Niekerk

    Hi Alonso,

    thank you so much for replying to my post. I never got a mail saying that you replied (do you know if there is a setting on sourceforge to enable this?).

    Anyway back to the issue; I got it solved. I realized that I was missing an exception on the server console RI and MyFaces conflict. I resolved this and the error was gone. I must admit that I still had to do a couple of things to get it to work and would gladly share my step-for-step process if there is a place to post it??

    Anyhow, I ran into another problem today: Basically trying to pass through a fromDate and toDate parameter to the report. Not sure if this is possible at all with JSF2?

    My Report (*.jrxml source):

    <parameter name="fromDate" class="java.lang.String">
    <parameterDescription><![CDATA[01/01/9999]]></parameterDescription>
    </parameter>
    <parameter name="toDate" class="java.lang.String">
    <parameterDescription><![CDATA[01/01/9999]]></parameterDescription>
    </parameter>
    <queryString>
    <![CDATA[select * from R2D2.TGT03_TRANS where TRANS_DATETIME BETWEEN TO_DATE($P{fromDate},'dd/MM/yyyy') AND TO_DATE($P{toDate},'dd/MM/yyyy')]]>
    </queryString>

    The Facelet:

    <p:panel id="reportPanel" rendered="#{runReport.showReport}">
    <h:form id="report">
    <h:outputText value="#{runReport.fromDate}" id="fromDateText"/>
    <jr:source id="transactionSource" type="jdbc" value="jdbc:oracle:thin:@localhost:1521:dev2">
    <f:attribute name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <f:attribute name="username" value="usr"/>
    <f:attribute name="password" value="pass"/>
    </jr:source>
    <jr:reportFrame id="myReportFrame" source="transactionSource" value="/reports/TransactionsParams.jrxml" format="pdf" height="599px" width="99%">
    <f:param name="fromDate" value="#{runReport.fromDate}"></f:param>
    <f:param name="toDate" value="#{runReport.toDate}"></f:param>
    </jr:reportFrame>
    </h:form>
    </p:panel>

    Just to explain what I am doing in the facelet:

    I have 2 primefaces panels; one contain the input fields for the from and toDate fields and a submit button and the other contain the jr:report. The action on the commandbutton sets the showReport to true and the report is rendered. Everything works 100% when I hardcode the values of fromDate and toDate, for example:

    <f:param name="fromDate" value="01/01/2012"></f:param>
    <f:param name="toDate" value="01/10/2012"></f:param>

    But as soon as I change it to lookup the values from the runReport bean the report comes out blank? I added that outputText field to the top of the report tags to check what the values were and they seem to update accordingly.

    Any suggestions will be sorely appreciated! :)
    Thank you again for replying!
    Regards
    Izaak

     
  • Izaak van Niekerk

    The report:

    <parameter name="fromDate" class="java.lang.String">
        <parameterDescription><![CDATA[01/01/9999]]></parameterDescription>
    </parameter>
    <parameter name="toDate" class="java.lang.String">
        <parameterDescription><![CDATA[01/01/9999]]></parameterDescription>
    </parameter>
    <queryString>
        <![CDATA[select * from R2D2.TGT03_TRANS where TRANS_DATETIME BETWEEN TO_DATE($P{fromDate},'dd/MM/yyyy') AND TO_DATE($P{toDate},'dd/MM/yyyy')]]>
    </queryString>
    
     
  • Izaak van Niekerk

    I couldn't get the facelet code to display, so I am adding it as an attachment :)
    (this is just a snippet containing the jr tags)

     
  • mohanjayapalan

    mohanjayapalan - 2013-07-18

    Hi

    I didn't get it.

    please tell me what will be the solution for this problem

    NoSuchReportComponentInViewException:

     
  • mohanjayapalan

    mohanjayapalan - 2013-07-18

    <ui:composition>
    <p:panel id="reportPanel">
    <h:form id="reportform">
    <jr:source id="jdbcSource" value="jdbc:mysql://localhost:3306/genericnmsdb">
    <f:attribute name="driverClassName" value="org.gjt.mm.mysql.Driver"/>

    I didn't get it.
    please tell me what will be the solution for this problem
    NoSuchReportComponentInViewException:

    This is my code.

    [code]

        <f:attribute name="username" value="root" />
                <f:attribute name="password" value="admin" />
            </jr:source>
            <h:panelGrid columns="3" cellpadding="10">
                <jr:reportLink id="reportLinkIndifier" format="pdf" source="jdbcSource" 
                    target="blank" value="/reports/nmsreport.jasper">
                    <h:outputText value="View Report" />
                </jr:reportLink>
    
                <p:commandButton actionListener="#{demoBean.PDF}" value="PDF">
                    <p:commandButton actionlistener="#{demoBean.DOCX}" value="Docx">
                        <p:commandButton actionlistener="#{demoBean.XLSX}" value="Xlsx">
                            <p:commandButton actionlistener="#{demoBean.ODT}" value="Odt">
                                <p:commandButton actionlistener="#{demoBean.PPT}" value="Ppt">
                                </p:commandButton>
                            </p:commandButton>
                        </p:commandButton>
                    </p:commandButton>
                </p:commandButton>
    
            </h:panelGrid>
            <p:dataTable border="1" value="#{demoBean.listOfUser}" var="user">
                <p:column headerText="Username">
    
                    <h:outputText value="#{user.user_name}" />
                </p:column>
    
                <p:column headerText="Password">
                    <h:outputText value="#{user.password}" />
                </p:column>
            </p:dataTable>
    
        </h:form>
        </p:panel>
    

    [/code]
    </ui:composition>

     

    Related

    Code: code

  • mohanjayapalan

    mohanjayapalan - 2013-07-18

    Please help me on above query....

    Someone please reply

     
  • Alonso Dominguez

    Hi mohsnjayapal,

    Sorry for the delay, could you please post here the stacktrace when you get the error. Also, a portion of the log file and some references about the dependencies that you are using may help a lot.

    Cheers

     
  • Nayanajith Galhenage

    Hi,
    I try to preview jasperreport using jasperreports-jsf-1.0-beta-4.jar in jboss7.1 with jsf. But i am getting net.sf.jasperreports.jsf.lifecycle.NoSuchReportComponentInViewException:.
    I am using this code to preview my report..

    <jr:source id="test1" type="jdbc" value="jdbc:mysql://localhost:3306/test" query="select * from customer">
            <f:attribute name="driverClassName" value="com.mysql.jdbc.Driver" />
            <f:attribute name="username" value="root" />
            <f:attribute name="password" value="root" />
        </jr:source>
    
         <h:form>
        <a> 
            <jr:reportFrame value="/reports/myreport.jasper" width="900px" height="300px" source="test1">
            </jr:reportFrame>
         </a>
    

    I have no idea whats the wrong with this... Can any one please help me with this?

     
    Last edit: Nayanajith Galhenage 2013-10-31
  • Ahmed

    Ahmed - 2013-12-25

    Hi all,
    Can anyone help me with the NoSuchReportComponentInViewException?
    Thanks in advance

     
  • Yan Langlois

    Yan Langlois - 2014-09-11

    Hi,

    I have the same probleme. In my case :

    Xhtml :

    <h:form>
         <r:commandLink value="show report" render="panel" 
              action="#{controleur.fillData()}" />
    </h:form>
    
    <r:popupPanel id="panel" modal="true" show="#{not empty myBeanDataSource}">
        <h:form id="jasperForm">
           <jr:reportFrame rendered="#{not empty myBeanDataSource}" 
                  id="jasperFrame" value="/report.jasper" 
                  width="300px" height="150px"
                  source="#{myBeanDataSource}" format="pdf" />
        </h:form>
     </r:popupPanel>
    

    I always get NoSuchReportComponentInViewException. In jasperJSF code source I see that the invokeOnComponent method always return false... Why ?

    public void beforePhase(PhaseEvent event) throws FacesException {
        FacesContext context = event.getFacesContext();
        if (!isReportRequest(context)) {
            return;
        }
    
        try {
            final ExternalContext extContext = context.getExternalContext();
            final String clientId = extContext
                    .getRequestParameterMap().get(Constants.PARAM_CLIENTID);
            if (clientId == null) {
                throw new MalformedReportURLException("Missed parameter: "
                        + Constants.PARAM_CLIENTID);
            }
    
            UIViewRoot viewRoot = context.getViewRoot();
            if (!viewRoot.invokeOnComponent(context, clientId, this)) {
                throw new NoSuchReportComponentInViewException(clientId);
            }
        } finally {
            context.responseComplete();
        }
    }
    
     
  • Yan Langlois

    Yan Langlois - 2014-09-11

    Hello,

    My problem was the ajax refresh from <r:commandLink/>. With <h:commandLink/> jasperreportjsf find my component.

    Someone can tell me how I can make it work with an ajax request ?

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks