JasperReportsJSF can´t find report

Help
2011-08-31
2012-10-10
  • Jose Herminio Parreno PIqueras

    Hello everybody!

    I am using JasperReports JSF integration plugin, I am using JBoss 6 +Prime
    faces + JasperReports Pluggin.

    I have succesfully installed the pluggin by adding the jar file to the WEB-
    INF/lib directory ( This message appears in the deploy: 2011-08-31
    10:13:41,704 INFO (Thread-2) JRJSF_0023: JasperReports JSF Plugin
    initialized.) But when I tried to display a simple report (just a select *
    jdbc source) with this code within an xhtml page:

    <jr:reportFrame
                    value="/pages/report2.jasper"
                    format="text/html"
                    name="report2"
                    source="jdbc">
                </jr:reportFrame>
    

    I get the followin error when displaying the page (the deploying was fine)

    2011-08-31 10:16:52,719 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/web-frontend-9.0.0-SNAPSHOT].[Faces Servlet]] (http-127.0.0.1-8080-1) Servlet.service() for servlet Faces Servlet threw exception: net.sf.jasperreports.jsf.lifecycle.NoSuchReportComponentInViewException: j_idt77
        at net.sf.jasperreports.jsf.lifecycle.RenderResponsePhaseListener.beforePhase(RenderResponsePhaseListener.java:108) [:]
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224) [:2.0.3-]
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95) [:2.0.3-]
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
        at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
        at java.lang.Thread.run(Unknown Source) [:1.6.0_22]
    

    And my report is in the .war file, in the folder i put in the value tag, and
    if i take a look to the source code generated, the " j_idt77" wich the pluggin
    doest found seems to be an "Clientid" or something like that

    iframe src="/web-frontend-9.0.0-SNAPSHOT/net.sf.jasperreports.jsf/render/repor
    t2.jsf?net.sf.jasperreports.jsf.clientId=j_idt77

    Please can anybody help me ? I just want to show a report using this pluggin
    for my work.

    Thanks in advance

     
  • Alonso Dominguez

    Hi Josete,

    That error is telling that for some reason, the plugin lifecycle couldn't find
    the report component in the faces' view, the value "j_idt77" is the report
    component's clientId (an internal Id used by JSF to uniquely identify the
    components inside a view) and you could change it by adding an "id" attribute
    to your "<jr:reportFrame>" tag.

    Since you're using an additional report source I would like to see the code
    snippet for that too. The best to way to address this will be that you file a
    bug report at (https://sourceforge.net/tracker/?group_id=212447&atid=1021785)
    and attach
    to it following items:
    - Source code of the JSF view that contains the report
    - Java source code of any JSF Managed Bean related to the view (if any)
    - HTML generated code extracted from the browser when the view is rendered
    - A complete Tomcat log file. Remove current logs, start tomcat and go straight to the report view, then attach the generated log file to the bug record.

    Alonso

     
  • Alonso Dominguez

    I took a look to the recently created bug report and before adding any comment
    there I would like to suggest you to try this:

    surround your <jr:reportFrame> component with a <h:form> component and try
    again. It should inside the <f:view> tags and inside of it the
    <jr:reportFrame>, you don't need to add any commandButton/commandLink, just
    the form. Also notice that the <jr:reportFrame> component will demand a
    "format" attribute.

    Get back to me in this forum thread with any further information you may have
    about the previous test

     
  • Jose Herminio Parreno PIqueras

    Hello Jason,

    Yes, exactly that was the problem ! now the report is appearing (but no images
    showed, like they were missing...) also if I refresh the page the iframe
    appears but completely empty! do you have any idea why? I guess is because the
    "post" of the form or anything like that...

    Anyway I want to thank you for the fast and quick response and feedback, this
    pluggin is really great work !

    Do you know btw why the report iframe empty itself when i refresh the page?

    Thanks in advance,

    Josete.

     
  • Jose Herminio Parreno PIqueras

    Sorry I called you Jason btw, this is the name of my job mate and I misstype
    it !
    Regards Alonso ;)

     
  • Alonso Dominguez

    I guess the problem with the empty report is regarding this issue:
    https://sourceforge.net/tracker/?func=detail&aid=3380773&group_id=212447&atid
    =1021785

    ...and it's still under investigation

    Can't find any clue about why the report iframe appears empty after a refresh,
    it shouldn't be the "post" of the form since the rendering is triggered by a
    "false post" (that's why I asked you to surround the report with a "<h:form>"
    tag). I'm thinking that maybe the browser is caching the request... even
    though the report response has specific headers to prevent the browser doing
    so... don't know, need to take a look over it

    Now I'm focused on a workaround for the "empty report issue", hope to find it
    soon...
    Alonso

     
  • Alonso Dominguez

    Hi Josete,

    I released a new distribution package of the plugin which has a solution to
    the bug I talked about in my previous post. While I was dealing with that
    issue I had a chance to look over the fact that the plugin doesn't work
    outside of a <h:form> tag, and, as I expected, it won't be possible to
    properly render reports without an enclosing form.

    The plugin's render process is triggered by a fake faces' request and it
    consists on restore the previous JSF view (using the stored "viewState") and
    then process the report components like if it were a normal JSF request. Since
    the view's "viewState" is stored inside JSF forms (as a hidden field) the
    plugin can't restore the JSF view if it doesn't contain a form in it.

    Anyway, would you mind to download the last distribution package and check
    everything works well now for you?

    Regards,
    Alonso

     
  • joe joseph

    joe joseph - 2011-09-08

    Hi, I switched to beta 4 version. I have the same exception. Here is my code:

    <f:subview xmlns="[url]http://www.w3.org/1999/xhtml[/url]"
          xmlns:h="[url]http://java.sun.com/jsf/html[/url]"
          xmlns:f="[url]http://java.sun.com/jsf/core[/url]"
          xmlns:ui="[url]http://java.sun.com/jsf/facelets[/url]"
          xmlns:rich="[url]http://richfaces.org/rich[/url]"
          xmlns:a4j="[url]http://richfaces.org/a4j[/url]"
          xmlns:jr="[url]http://jasperreportjsf.sf.net/tld/jasperreports-jsf-1_2.tld[/url]"
          xmlns:dc="[url]http://www.afrikbrain.com/PME/EStock/Facelets/Taglib/EStockDialogComponent[/url]">
    
        <dc:EStockParameterDialogComponent
            id = "ReportViewer"
            width = "800"
            height = "700"
            showWhenRendered = "#{commandListPanel.reportViewer.open}"
            titleIcon = "#{commandListPanel.reportViewer.icon}"
            title = "#{messages[reportviewer.title]}"
            closeIcon = "#{viewHelper.sessionSkinURL}/Images/DialogClose.png">
    
            <ui:define name="closeIconAction">
                <a4j:support action="#{commandListPanel.reportViewer.cancel}" event="onclick" onsubmit="Richfaces.hideModalPanel('EStockReportViewer');"/>
            </ui:define>
    
            <ui:define name="defineDialogContent">
    
                <table>
    
                        <tr>
    
                            <td>
    
                                <fieldset class="fieldSetStyle">
                                        <legend>
                                            <h:outputText value="#{messages['estock.report.configuration.fieldset.title']}"/>
                                        </legend>
    
                                             <h:panelGrid columns="15">     
                                                    <h:selectBooleanCheckbox value="#{commandListPanel.reportViewer.printFooter}"/>
                                                    <h:outputText value="#{messages['estock.report.print.flyleaf']}" styleClass="labelStyle" style="font-weight:bold;"/>
                                                    <rich:spacer width="5px"/>
    
                                                    <h:selectBooleanCheckbox value="#{commandListPanel.reportViewer.printHeader}"/>
                                                    <h:outputText value="#{messages['estock.report.print.header']}" styleClass="labelStyle" style="font-weight:bold;"/>
                                                    <rich:spacer width="5px"/>
    
                                                    <h:selectBooleanCheckbox value="#{commandListPanel.reportViewer.printFooter}"/>                                             
                                                    <h:outputText value="#{messages['estock.report.print.footer']}" styleClass="labelStyle" style="font-weight:bold;"/>
                                                    <rich:spacer width="5px"/>
    
                                                    <h:selectBooleanCheckbox value="#{commandListPanel.reportViewer.printDetail}"/>
                                                    <h:outputText value="#{messages['estock.report.print.detail']}" styleClass="labelStyle" style="font-weight:bold;"/>
                                                    <rich:spacer width="5px"/>
    
                                                    <h:selectBooleanCheckbox value="#{commandListPanel.reportViewer.printGraphic}"/>
                                                    <h:outputText value="#{messages['estock.report.print.graphic']}" styleClass="labelStyle" style="font-weight:bold;"/>
                                                    <rich:spacer width="5px"/>
    
                                            </h:panelGrid>
    
                                 </fieldset>
    
                            </td>
    
                         </tr>
                         </table>
    
                                        <h:form>
                                                <jr:reportFrame 
                                                     value="/reports/BonCommande.jasper" 
                                                     format="pdf" 
                                                     name="TestReport" 
                                                     rendered="true"
                                                     style="width: 500px; height: 700px;">
    
                                                     <jr:source id="dataSource" type="bean" value="#{commandListPanel.reportViewer.principalDataSource}"/>
    
                                                     <f:param name="Enterprise_Slogan" value="MLKJLKJLKJ"/>
                                                     <f:param name="Enterprise_Designation" value="Afrikbrain SA!"/>
                                                     <f:param name="Enterprise_ActivitySector" value="Developpement de logiciels"/>
                                                     <f:param name="Enterprise_Capital" value="#{loggingDataBean.capital}"/>
                                                     <f:param name="Enterprise_Taxpayernumber" value="45SSE65JNKL"/>
                                                     <f:param name="Enterprise_Siege" value="Yaounde"/>
                                                     <f:param name="Enterprise_FixedPhone" value="741847654"/>
                                                     <f:param name="Enterprise_MobilePhone" value="741847654"/>
                                                     <f:param name="Enterprise_WebSite" value="www.afrikbrain.com"/>
                                                     <f:param name="Enterprise_Slogan" value="Yes we can, sure we can!"/>
                                                     <f:param name="Enterprise_Email" value="contact@afrikbrain.com"/>
                                                     <f:param name="Enterprise_PoBox" value="45621"/>
                                                     <f:param name="Enterprise_Slogan" value="Yes we sure we can!"/>
                                                     <f:param name="Enterprise_Road" value="Rue Foe"/>
                                                     <f:param name="Enterprise_Fax" value="741847654"/>
                                                     <f:param name="Enterprise_Town" value="yaounde"/>
                                                     <f:param name="Enterprise_Country" value="Cameroun"/>
                                                     <f:param name="Report_User" value="Guilene"/>
                                                     <f:param name="Report_MainTitle" value="Audit des transactions"/>
                                                     <f:param name="Report_Application" value="Genezis Test"/>
                                                     <f:param name="PrintDetail" value="#{commandListPanel.reportViewer.printDetail}"/>
                                                     <f:param name="PrintHeader" value="#{commandListPanel.reportViewer.printHeader}"/>
                                                     <f:param name="PrintFooter" value="#{commandListPanel.reportViewer.printFooter}"/>
                                                     <f:param name="PrintTitle" value="#{commandListPanel.reportViewer.printFlyLeaf}"/>
                                                     <f:param name="REPORT_RESOURCE_BUNDLE" value="#{commandListPanel.reportViewer.resourceBundle}"/>
                                                     <!-- <f:param name="REPORT_LOCALE" value="#{commandListPanel.report}"/>-->
                                                     <!-- <f:param name="REPORT_TIME_ZONE" value="#{loggingDataBean.timeZone}"/>-->
    
                                                </jr:reportFrame>
                                        </h:form>
    
                <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
    
                    <tr>
                        <td width="100%" align="right">
    
                            <h:panelGrid columns="3">
                                <a4j:commandButton value="#{messages['estock.report.btnclose']}" action="#{commandListPanel.reportViewer.close}"  reRender="ClientAreaContainer" styleClass="commandButtonStyle" onclick="startWaitInStyle();" oncomplete="stoptWaitInStyle();" />
                            </h:panelGrid>
    
                        </td>
                    </tr>
    
                </table>
    
            </ui:define>
    
        </dc:EStockParameterDialogComponent>
    
        <ui:include src="#{commandListPanel.reportViewer.errorDialogDefinition}" />
        <ui:include src="#{commandListPanel.reportViewer.informationDialogDefinition}" />
        <ui:include src="#{commandListPanel.reportViewer.waitDialogDefinition}" />
    
    </f:subview>
    

    What's the pb with my code?

     
  • Alonso Dominguez

    Hi, could you please post here a stacktrace of the error too? Also, if you
    could open logging levels for the plugin and post here what you get it'll be
    great.

    btw, did you tried making the form's scope wider? I mean, now your JSF just
    contains the report, you should try to move into a higher level in the tree
    view, enclosing the whole view, for example...

    Regards

     
  • joe joseph

    joe joseph - 2011-09-09

    Here is my full stack trace:

    10:31:35,953 WARN  [lifecycle] phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@839589) threw exception: net.sf.jasperreports.jsf.lifecycle.NoSuchReportComponentInViewException: j_id810:j_id946:ModalDialogForm:j_id983:j_id984 j_id810:j_id946:ModalDialogForm:j_id983:j_id984
    net.sf.jasperreports.jsf.lifecycle.RenderResponsePhaseListener.beforePhase(RenderResponsePhaseListener.java:108)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    com.afrikbrain.pme.estockmanager.presentation.tools.filters.UserInitializerFilter.doFilter(UserInitializerFilter.java:71)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
    org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Unknown Source)
    

    Also, I which you could indicate how to:

    • Open logging levels for the plugin.
     
  • Alonso Dominguez

    Opening the logging levels for the plugin depends on your server application.
    JR-JSF uses the JDK logging framework so it delegates logging configuration
    and handling to the servlet container.

    If you're using tomcat you can edit the file
    ${TOMCAT_HOME}/conf/logging.properties and add following line:

    net.sf.jasperreports.jsf.level=FINER
    

    Additionally, you can open debug logging level for JasperReports with
    following line:

    net.sf.jasperreports.level=FINE
    

    Logging config changes will be enabled after restarting the server.

    If you're using a different servlet container, please take a look for "logging
    configuration" in the reference documentation for that specific servlet
    container. In that case, the name of the loggers' names are the same as stated
    above these lines but dropping the last ".level" from the name.

    thanks,
    Alonso

     
  • joe joseph

    joe joseph - 2011-09-25

    My Application Server is JBOSS 4.2. Can you please provide how to open logging
    levels for the plugin?

     
  • Alonso Dominguez

    As it said in this page: http://docs.jboss.org/process-
    guide/en/html/logging.html,
    JBoss uses Log4j as logging framework.

    You have two options:
    1. Configure logging in a log4j.xml configuration file and redirect all logging from the plugin to the JBoss logging framework (log4j). For achieving that you may need to add jul-over-slf4j.jar and slf4j-log4jXX.jar to your application classpath.
    2. Proceed as it's said in previous link at the bottom of the page and change the JBoss logging framework from log4j to JDK logging.

     

Log in to post a comment.