6 Replies Latest reply on May 16, 2008 2:19 PM by Berkay Aktan

    Seam iText Error

    Berkay Aktan Newbie

      Hi Seam Experts,


      I'm getting weird instantiation error from seam's itext example.


      All the seam jars including itext.jar and jboss-seam-pdf.jar  are in the classpath.



      (jboss4.2/seam 2.0.1GA/jboss tools 2.0.0/ear project)


      please help me..thanx.


      18:30:38,250 ERROR [STDERR] Apr 3, 2008 6:30:38 PM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/whyseam.xhtml]
      javax.faces.FacesException: javax.faces.FacesException: Cant instantiate class: org.jboss.seam.pdf.ui.UIDocument.
           at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:545)
           at org.jboss.seam.jsf.SeamApplication.createComponent(SeamApplication.java:91)
           at com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:243)
           at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:139)
           at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
           at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
           at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
           at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
           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.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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:45)
           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.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:595)
      Caused by: javax.faces.FacesException: Cant instantiate class: org.jboss.seam.pdf.ui.UIDocument.
           at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1016)
           at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:539)
           ... 53 more
      



      web.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" 
               xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
          
          <context-param>
              <param-name>org.richfaces.SKIN</param-name>
              <param-value>emeraldTown</param-value>
          </context-param> 
      
          <filter> 
              <display-name>Ajax4jsf Filter</display-name> 
              <filter-name>ajax4jsf</filter-name> 
              <filter-class>org.ajax4jsf.Filter</filter-class> 
          </filter> 
          <filter-mapping> 
              <filter-name>ajax4jsf</filter-name> 
              <servlet-name>Faces Servlet</servlet-name>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>INCLUDE</dispatcher>
          </filter-mapping>
          
      
          <listener>
              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
          </listener>
          
          <filter>
              <filter-name>Seam Filter</filter-name>
              <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
          </filter>
      
          <filter-mapping>
              <filter-name>Seam Filter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>
      
      
          
          <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.xhtml</param-value>
          </context-param>
      
          <context-param>
              <param-name>facelets.DEVELOPMENT</param-name>
              <param-value>true</param-value>
          </context-param>
      
          <servlet> 
              <servlet-name>Seam Resource Servlet</servlet-name> 
              <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> 
          </servlet> 
      
          <servlet-mapping> 
              <servlet-name>Seam Resource Servlet</servlet-name> 
              <url-pattern>/seam/resource/*</url-pattern> 
          </servlet-mapping> 
      
          <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
          
          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.seam</url-pattern>
          </servlet-mapping>
      
          <servlet>
              <servlet-name>Document Store Servlet</servlet-name>
              <servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class>
          </servlet>
      
          <servlet-mapping>
              <servlet-name>Document Store Servlet</servlet-name>
              <url-pattern>*.pdf</url-pattern>
          </servlet-mapping>
      
          <session-config>
              <session-timeout>10</session-timeout> 
          </session-config>
          
      </web-app>
      



      components.xml


      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:pdf="http://jboss.com/products/seam/pdf"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:framework="http://jboss.com/products/seam/framework"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                                      http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd
                                      http://jboss.com/products/seam/pdf http://jboss.com/products/seam/pdf-2.0.xsd   
                                      http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
      
          <pdf:document-store use-extensions="true" error-page="/pdfMissing.seam" />
      
          <pdf:key-store-config key-store="pdf.keystore"
                                key-store-password="storepass"
                                key-password="keypass"
                                key-alias="pdfKey" />
      
          <core:init debug="true" jndi-pattern="@jndiPattern@" />
      
      </components>
      


        • 1. Re: Seam iText Error
          Norman Richards Expert

          Can you show your EAR/WAR structure?

          • 2. Re: Seam iText Error
            Vemula sriramsudheer Newbie

            I am also having same sort of problem and mine is WAR deployment could any one able to find solution please

            • 3. Re: Seam iText Error
              Khaled Yousfi Newbie

              have you tried the itext example that comes with the seam distribution ?

              • 4. Re: Seam iText Error
                Sheldon du Trevou Newbie

                Hi


                I was having the same issue as you and I went through the iText Seam example and found that they have the itext.jar in their build path.  Once I added this to my build path it worked.


                Hope it helps.


                PS : No where did I read that the itext.jar had to be added to the build path.

                • 5. Re: Seam iText Error
                  aymen houissa Newbie

                  Hi,
                  I'm getting some instantiation error when i tried to include iText in my application
                  Note: the iText Seam example works fine



                  please help me..thanx.


                  javax.faces.FacesException: javax.faces.FacesException: Cant instantiate class: org.jboss.seam.pdf.ui.UIDocument.
                       at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:545)
                       at org.jboss.seam.jsf.SeamApplication.createComponent(SeamApplication.java:91)
                       at com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:243)
                       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:139)
                       at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                       at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                       at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
                       at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
                       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
                       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:45)
                       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:56)
                       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:158)
                       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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                       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: javax.faces.FacesException: Cant instantiate class: org.jboss.seam.pdf.ui.UIDocument.
                       at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1016)
                       at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:539)
                       ... 51 more
                  Caused by: java.lang.NoClassDefFoundError: com/lowagie/text/DocWriter
                       at java.lang.Class.getDeclaredConstructors0(Native Method)
                       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
                       at java.lang.Class.getConstructor0(Class.java:2699)
                       at java.lang.Class.newInstance0(Class.java:326)
                       at java.lang.Class.newInstance(Class.java:308)
                       at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1014)
                       ... 52 more




                  component.xml


                  <components xmlns="http://jboss.com/products/seam/components"
                              xmlns:pdf="http://jboss.com/products/seam/pdf"
                              xmlns:core="http://jboss.com/products/seam/core"
                              xmlns:framework="http://jboss.com/products/seam/framework"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                                                  http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd
                                                  http://jboss.com/products/seam/pdf http://jboss.com/products/seam/pdf-2.0.xsd   
                                                  http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                  
                      <pdf:document-store use-extensions="true" error-page="/pdfMissing.seam" />
                  <core:init debug="true" jndi-pattern="@jndiPattern@" />
                  
                  


                  web.xml


                  <?xml version="1.0" ?>
                  <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                       version="2.5">
                  
                       <!-- Ajax4jsf -->
                  
                       <context-param>
                            <param-name>org.richfaces.SKIN</param-name>
                            <param-value>blueSky</param-value>
                       </context-param>
                  
                       <!-- Seam -->
                  
                       <listener>
                            <listener-class>
                                 org.jboss.seam.servlet.SeamListener
                            </listener-class>
                       </listener>
                  
                       <filter>
                            <filter-name>Seam Filter</filter-name>
                            <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                       </filter>
                  
                       <filter-mapping>
                            <filter-name>Seam Filter</filter-name>
                            <url-pattern>/*</url-pattern>
                       </filter-mapping>
                  
                       <servlet>
                            <servlet-name>Seam Resource Servlet</servlet-name>
                            <servlet-class>
                                 org.jboss.seam.servlet.SeamResourceServlet
                            </servlet-class>
                       </servlet>
                  
                       <servlet-mapping>
                            <servlet-name>Seam Resource Servlet</servlet-name>
                            <url-pattern>/seam/resource/*</url-pattern>
                       </servlet-mapping>
                  
                       <!-- Facelets development mode (disable in production) -->
                  
                       <context-param>
                            <param-name>facelets.DEVELOPMENT</param-name>
                            <param-value>true</param-value>
                       </context-param>
                       <!--     <context-param>-->
                       <!--          <param-name>facelets.SKIP_COMMENTS</param-name>-->
                       <!--          <param-value>true</param-value>-->
                       <!--     </context-param>-->
                  
                       <!-- JSF -->
                  
                       <context-param>
                            <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                            <param-value>.xhtml</param-value>
                       </context-param>
                  
                       <servlet>
                            <servlet-name>Faces Servlet</servlet-name>
                            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                            <load-on-startup>1</load-on-startup>
                       </servlet>
                  
                       <servlet-mapping>
                            <servlet-name>Faces Servlet</servlet-name>
                            <url-pattern>*.seam</url-pattern>
                       </servlet-mapping>
                  
                       <security-constraint>
                            <display-name>Restrict raw XHTML Documents</display-name>
                            <web-resource-collection>
                                 <web-resource-name>XHTML</web-resource-name>
                                 <url-pattern>*.xhtml</url-pattern>
                            </web-resource-collection>
                            <auth-constraint />
                       </security-constraint>
                  
                       <servlet>
                            <servlet-name>Document Store Servlet</servlet-name>
                            <servlet-class>
                                 org.jboss.seam.pdf.DocumentStoreServlet
                            </servlet-class>
                       </servlet>
                       <servlet-mapping>
                            <servlet-name>Document Store Servlet</servlet-name>
                            <url-pattern>*.pdf</url-pattern>
                       </servlet-mapping>
                  
                  </web-app>
                  


                  please help


                  • 6. Re: Seam iText Error
                    Berkay Aktan Newbie

                    Yes Sheldon is right.I added iText.jar into my build path, it worked.
                    i was expecting NoClassDef.


                    thanks..