5 Replies Latest reply on Apr 1, 2007 1:40 PM by Norman Richards

    pdf - IllegalStateException

    Oliver Charlet Newbie

      Hi,

      I try to render PDFs. I use the lists.xhtml form the seam examples.

      I configured the SeamServeltFilter and DocumentStoreServelt as documented (1.2.0 GA).

      It seems, that the pdf is created, but cannot be retrieved.
      I see, that the extension is changed to *.pdf, but
      I get the following error:

      avax.servlet.ServletException
       org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:103)
       org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:73)
       org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      root cause
      
      java.lang.IllegalStateException
       org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:432)
       org.jboss.seam.mock.MockExternalContext.redirect(MockExternalContext.java:477)
       org.jboss.seam.core.Manager.redirect(Manager.java:993)
       org.jboss.seam.core.Redirect.execute(Redirect.java:137)
       org.jboss.seam.exceptions.DebugPageHandler.handle(DebugPageHandler.java:30)
       org.jboss.seam.core.Exceptions.handle(Exceptions.java:70)
       org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:91)
       org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:73)
       org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      


      I guess it's a config problem, but AFAIK my configuration is as it should be...

      thanks for any help

        • 1. Re: pdf - IllegalStateException
          Oliver Charlet Newbie

          in the log there is another root cause to the above exceptions:

          13:13:51,641 ERROR [ExceptionFilter] uncaught exception
          java.lang.IllegalStateException: No active event context
           at org.jboss.seam.core.Manager.instance(Manager.java:264)
           at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:412)
           at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:328)
           at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:63)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:2
          


          I have no idea, what could be wrong here.....

          again, thanks for any help

          • 2. Re: pdf - IllegalStateException
            Oliver Charlet Newbie

            ok, again just for the record and in case there are some other seam dummies like me:

            A pdf file can only be viewed if there is an existing converstation. That means, at least in my case, that a simple call to /test.pdf does not work, unless there is a long running conversation, that was started by any component.

            hope that helps someone...

            • 3. Re: pdf - IllegalStateException
              Norman Richards Master

              That is partially correct. The .pdf view can only be accessed after the PDF is generated. You don't need to worry about a conversation. A temporary conversation will be promoted to a long-running conversation for long enough to serve the redirect to the PDF.

              • 4. Re: pdf - IllegalStateException
                Oliver Charlet Newbie

                than I don't understand the behaviour here. If I call the pdf's URl fist thing after server startup, i.e. e new session, I get the above error. If I first call a page, that uses a conversational component, I can afterwards call the pdf and get it.
                Maybe, if you find some time, you could document more on how to use the DocumentStore and explain the runtime situation, so one can more understand what exactly is going on.

                Besides that - using iText in seam is damn easy and a joy to work with. Thanks for your work!

                regards
                :ollix

                • 5. Re: pdf - IllegalStateException
                  Norman Richards Master

                  You cannot access the .pdf URL directly. You must be redirected to it from the .seam URL. The redirect will temporarily extend the conversation if it needs to so you never have to worry if you are in a conversation or not.

                  I would like to support direct access to the .pdf URL, but we don't now due to Facelets limitations with binary data. I have a couple ideas how to work around it, but I haven't got it down just yet.