14 Replies Latest reply on Dec 28, 2008 1:28 AM by Kim Kuylen

    PDF Generation Image problems (configuration issue?)

    Catherine Curtiss Newbie

      I'm trying to use the Seam PDF capabilities in my project (using Seam 2.0.1GA). I modified my components.xml, my web.xml and the PDF works in a limited capacity. Text will work just fine, but if I try to include an image I get the following:



      Caused by: java.lang.IllegalArgumentException: input == null!
           at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:313)
           at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
           at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
           at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
           at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:129)
           at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
           at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)


      The image is in a location where the PDF should be able to find it. Am I possibly missing a configuration setting somewhere? I'm using the whyseam.xtml provided with the seam examples.

        • 1. Re: PDF Generation Image problems (configuration issue?)
          Damian Harvey Apprentice

          More likely that you're just specifying the tag wrong. Show your code and the full stack trace. Does the example Seam iText app work for you?


          Cheers,


          Damian.

          • 2. Re: PDF Generation Image problems (configuration issue?)
            Catherine Curtiss Newbie

            The code is the whyseam.xhtml file included in the itext example. Snippet is:



            <p:document xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:p="http://jboss.com/products/seam/pdf"
                        title="Why Seam"
                        keywords="mykeyword"
                        subject="seam"
                        author="Seam Team"
                        creator="Seam PDF example app">
            
                <f:facet name="header">
                    <p:font size="12">
                        <p:footer borderWidthTop="1" borderColorTop="blue" borderWidthBottom="0" alignment="center">Why Seam? [<p:pageNumber />]</p:footer>
                    </p:font>
                </f:facet>
            
                <p:image alignment="right" wrap="true" value="jboss.jpg" /> 
                <p:font size="24"><p:paragraph backgroundColor="red" spacingAfter="50">Ten Good Reasons To Use Seam</p:paragraph></p:font>  
            
                <p:font color="blue" size="18"><p:paragraph>It's the quickest way to get "rich"</p:paragraph></p:font>
            
            ...more here...
            
            </p:document>




            If I remove the p:image the PDF generation works just fine. Full stack trace is:



            java.lang.IllegalArgumentException: input == null!
                 at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:313)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
                 at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
                 at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:129)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
                 at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                 at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                 at java.lang.Thread.run(Thread.java:619)
            13:27:05,137 WARN  [lifecycle] executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1f7a927) threw exception
            java.lang.IllegalArgumentException: input == null!
                 at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:313)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
                 at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
                 at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:129)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
                 at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                 at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                 at java.lang.Thread.run(Thread.java:619)
            13:27:05,152 ERROR [ExceptionFilter] handling uncaught exception
            javax.servlet.ServletException: input == null!
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                 at java.lang.Thread.run(Thread.java:619)
            Caused by: java.lang.IllegalArgumentException: input == null!
                 at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:313)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
                 at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
                 at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:129)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
                 at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                 at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 ... 36 more
            13:27:05,152 ERROR [ExceptionFilter] exception root cause
            java.lang.IllegalArgumentException: input == null!
                 at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:313)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
                 at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
                 at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
                 at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:129)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
                 at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
                 at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                 at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                 at java.lang.Thread.run(Thread.java:619)




            • 3. Re: PDF Generation Image problems (configuration issue?)
              Norman Richards Expert

              What happens if you put a / at the front of your image name?

              • 4. Re: PDF Generation Image problems (configuration issue?)
                Catherine Curtiss Newbie

                I get the same error with the / in front of the image name. I tried moving the image around a bit thinking perhaps it was not in the right location. But, I would imagine the PDF generator would not return such an error for just a missing image.


                Do you need any additional jars other than the basic seam ones (which in that I'm including seam-pdf)? I was under the impression it would work out of the box except for a few minor config. changes, but perhaps I misunderstood.

                • 5. Re: PDF Generation Image problems (configuration issue?)
                  Damian Harvey Apprentice

                  It does return input == null if it can't find the image, so that's your issue. If you're having difficulty locating it with a relative path try appending
                  #{facesContext.externalContext.requestContextPath} eg

                  <p:image value="#{facesContext.externalContext.requestContextPath}/yourpath/jboss.jpg"/>


                  Cheers,


                  Damian.

                  • 6. Re: PDF Generation Image problems (configuration issue?)
                    Steve Hunter Newbie

                    I've been having the same issue since switching to Seam 2.0.0 with JBoss 4.2.2 GA.  Previously the exact same PDF worked fine on Seam 1.2.2 with Jboss 4.0.5 GA but no longer can generate the p:image.  Put the itext and jboss-seam-pdf jar files into WEB-INF lib and can generate a PDF no problem however the p:image tag returns following error msg:


                    java.lang.IllegalArgumentException: input == null!
                    at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:311)
                    at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:440)
                    at org.jboss.seam.ui.graphicImage.Image.readImage(Image.java:394)
                    at org.jboss.seam.ui.graphicImage.Image.setInput(Image.java:141)
                    ...


                    Here's my code:


                    <p:image alignment=right wrap=true value=#{facesContext.externalContext.requestContextPath}/img/jboss.jpg/>


                    File is located in the project WAR under the img directory as jboss.jpg.


                    If I remove the facesContext the error message (value=/img/jboss.jpg/) changes to:



                      java.lang.RuntimeException: java.io.IOException: The byte array is not a recognized imageformat. 



                    Alternately (to experiment) if I use the resource or imageData tag instead of value, with or without facesContext I get a NullPointerException:


                      java.lang.NullPointerException
                         at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
                         


                    Have also tried using value=#{rptAnnualPlanAction.rptImageFile} with the below code but exact same results:


                    FacesContext facesContext = FacesContext.getCurrentInstance();
                    ExternalContext externalContext = facesContext.getExternalContext();
                    String path = externalContext.getResource(/img/saanichcoloursm.gif).getPath();
                    Image rptImage = Toolkit.getDefaultToolkit().createImage(path);
                    setRptImageFile          (rptImage);


                    Any help would be appreciated.


                    • 7. Re: PDF Generation Image problems (configuration issue?)
                      Norman Richards Expert

                      What kind of image is it?  I recall the Image library having problems with certain types of images in the past, but I don't think we ever got JIRA issues.  Try dropping your image into the seam-itext example and see if it fails in the same way.  Or, try dropping the jboss logo from the seam-itext example into your app just to test.  If it is, let us know what kind of image it is and we'll see what we can do.

                      • 8. Re: PDF Generation Image problems (configuration issue?)
                        Steve Hunter Newbie

                        Hey Norman, thanks for the help. Went back to basics using the iText example as you suggested and figured out the issue.


                        Here's a weird one, in my older Seam 1.2.2 project I had a report page with a set of filters and a view report commandbutton which opened up a new browser window to view the report. Used an onclick window.open popup call inside the commandButton.


                        Apparently the popup was unable to find the image file in the newer Seam 2.0.0 project even though it used the exact same procedure as the older project. When I went back to simply opening the report in the same window it was called everything worked fine.


                        Not sure what changed between versions but at least I know the work around.


                        Thanks, Steve

                        • 9. Re: PDF Generation Image problems (configuration issue?)
                          Steve Hunter Newbie

                          Also forgot to mention that I needed to resave the GIF as a JPG otherwise throws an error: The byte array is not a recognized imageformat.

                          • 10. Re: PDF Generation Image problems (configuration issue?)
                            Chris Cheng Newbie

                            Hi all,


                            I have the image problems within the PDF. Everything is working fine except the image part. I need to display multiple images in PDF generation.


                            This p:image is working fine.


                            <p:image value="/images/logo.gif" width="450" height="49" alignment="left"/>




                            But this one is dynamic image saved on separate server.


                            <p:html><img src="#{attachmentStreamer.getUrlPath(book.imageAttachment, 100, 100,'jpg',false)}" alt=" " border="0" width="32" height="32"/>
                            </p:html>




                            It generated the exception:


                            -   Exception
                            Exception during request processing:
                            Caused by javax.servlet.ServletException with message: "c:\attachments\100\100\4124789.jpg" 



                            But it works when I put the hostname in.



                            <p:html><img src="http://localhost/#{attachmentStreamer.getUrlPath(book.imageAttachment, 100, 100,'jpg',false)}" alt=" " border="0" width="32" height="32"/></p:html>



                            Any input would be appreciated, many thanks,


                            Chris


                            • 11. Re: PDF Generation Image problems (configuration issue?)
                              jeremy girard Newbie

                              Hi.


                              I've got the same problem you have.
                              I solve it by calling a seam component that build a java.awt.image with the URL



                              <p:image value="#{imageAction.getImage(image.url)}" alignment="center"/>



                              But i have another problem.
                              This is done in a ui:repeat tag. The image size is about 700ko.


                              It works fine when there is about 30 images but it create an invalid pdf if there is more images.


                              Any idea ?


                              I think there is a memory leek. All stream are close by the seam component but all the java.awt.Image given
                              to the pdf generator are not garbage collected after the generation

                              • 12. Re: PDF Generation Image problems (configuration issue?)
                                Catherine Curtiss Newbie

                                In general, my JPGs and GIFs seem to work ok, I just have to use the full URL (http://www.seamframework.org/images/testimage.jpg for example). A relative has never worked. So I have a backing function that returns my main URL, and I just append the image name.

                                • 13. Re: PDF Generation Image problems (configuration issue?)
                                  Kim Kuylen Newbie

                                  Hi,


                                  I have some images stored as bytearray's in my database (a mix of png, gif and jpg). I am trying to display them in a table by making use of iText...I receive the following error when I try to display the pdf file:



                                  java.lang.NullPointerException
                                       at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
                                       at com.lowagie.text.Image.getInstance(Unknown Source)
                                       at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:140)
                                       at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
                                       at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
                                       at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
                                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                                  ...
                                  ...



                                  The iText code I am using and which is giving the problems is:



                                  <ui:repeat value="#{delivery.transactions}" var="transaction">
                                                     <p:cell>#{transaction.item.name}</p:cell>
                                                     <p:cell>#{transaction.assetNumber}</p:cell>
                                                     <p:cell>#{transaction.serialNumber}</p:cell>
                                                     <p:cell><p:image value="#{utilAction.getAwtImage(transaction.item.image.data)}"/></p:cell>
                                                  </ui:repeat>



                                  The getAwtImage routine is listed here:



                                  import java.awt.Image;
                                  import java.awt.Toolkit;
                                  public Image getAwtImage(byte[] data) {
                                            
                                            return Toolkit.getDefaultToolkit().createImage(data);
                                       }



                                  In debug mode I can see that the routine getAwtImage is nicely called and is returning a java.awt.Image....but then I bump into the java.lang.NullPointerException exception


                                  I am able to include a static image by making use of the following iText code:



                                  <p:image value="/img/logo.jpg"/>



                                  I am using iText 2.1.4; Seam 2.0.2.SP1; JBoss 4.2.2.GA


                                  Has someone got an idea?


                                    

                                  • 14. Re: PDF Generation Image problems (configuration issue?)
                                    Kim Kuylen Newbie

                                    I found the answer to my own problem... so let's share :)


                                    I replaced my getAWTImage routine with the following code and now everything works like a charm:



                                    public ByteArrayInputStream getAwtImage(byte[] data) {
                                              ByteArrayInputStream inStream = new ByteArrayInputStream(data);
                                              ByteArrayOutputStream outStream = new ByteArrayOutputStream();             
                                              try {
                                                   BufferedImage image = ImageIO.read(inStream);
                                                   ImageIO.write(image, "JPEG", outStream);
                                                   outStream.close();
                                              } catch (IOException e) {
                                                   log.info("Unable to convert image to JPEG format");
                                                   e.printStackTrace();
                                              }
                                              return new ByteArrayInputStream(outStream.toByteArray());
                                         }
                                    



                                    So in short, I needed to return a ByteArrayInputStream (and not a java.awt.Image) object AND I needed to convert all my images to the JPEG format...hence the ImageIO usage.


                                    Hope this helps someone else ;-)