5 Replies Latest reply on Aug 17, 2011 7:47 AM by Bernard Labno

    SEAM 2.1.1.GA - Cant instantiate class: org.jboss.seam.pdf.ui.UIDocument.

    Ondrej Sevce Newbie

      Hi,


      I migrated one project from SEAM 2.0.0.GA to SEAM 2.1.1.GA by creating new project with 2.1.1. seam-gen and then migrating the sources. It went quite well, but I fail to get to work my PDF exports.


      Here is my 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">
      
         <!-- RichFaces -->
      
         <context-param>
            <param-name>org.richfaces.SKIN</param-name>
            <param-value>blueSky</param-value>
         </context-param>
      
         <!-- Suppress spurious stylesheets -->
      
         <context-param>
            <param-name>org.richfaces.CONTROL_SKINNING</param-name>
            <param-value>disable</param-value>
         </context-param>
      
         <context-param>
            <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
            <param-value>disable</param-value>
         </context-param>
      
         <!-- Change load strategy to DEFAULT to disable sending scripts/styles as packs -->
      
         <context-param>
            <param-name>org.richfaces.LoadStyleStrategy</param-name>
            <param-value>ALL</param-value>
         </context-param>
      
         <context-param>
            <param-name>org.richfaces.LoadScriptStrategy</param-name>
            <param-value>ALL</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>
      
         <!-- 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>
         
         <servlet>
              <servlet-name>Document Store Servlet</servlet-name>
              <servlet-class>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
          </servlet>
      
          <servlet-mapping>
              <servlet-name>Document Store Servlet</servlet-name>
              <url-pattern>*.pdf</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>
      
      </web-app>




      Here is my components.xml:



      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:pdf="http://jboss.com/products/seam/pdf"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:drools="http://jboss.com/products/seam/drools"
                  xmlns:bpm="http://jboss.com/products/seam/bpm"
                  xmlns:security="http://jboss.com/products/seam/security"
                  xmlns:mail="http://jboss.com/products/seam/mail"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd
                       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd 
                       http://jboss.com/products/seam/pdf http://jboss.com/products/seam/pdf-2.1.xsd         
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
      
         <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
      
         <component name="org.jboss.seam.debug.hotDeployFilter">
            <property name="urlPattern">*.seam</property>
         </component>
      
         <core:manager concurrent-request-timeout="10000"
                       conversation-timeout="120000"
                       conversation-id-parameter="cid"
                       parent-conversation-id-parameter="pid"/>
      
         <persistence:managed-persistence-context name="entityManager"
                                           auto-create="true"
                                entity-manager-factory="#{intranetEntityManagerFactory}"/>
      
         <persistence:entity-manager-factory name="intranetEntityManagerFactory"
                            persistence-unit-name="intranet"/>
      
         <component name="org.jboss.seam.document.documentStore"> 
              <property name="useExtensions">true</property>
              <property name="errorPage">/pdfMissing.seam</property>
          </component>
      
          <pdf:key-store-config key-store="pdf.keystore"
                                key-store-password="storepass"
                                key-password="keypass"
                                key-alias="pdfKey" />
            
         <drools:rule-base name="securityRules">
            <drools:rule-files><value>/security.drl</value></drools:rule-files>
         </drools:rule-base>
      
         <security:rule-based-permission-resolver security-rules="#{securityRules}"/>
      
         <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>
      
         <event type="org.jboss.seam.security.notLoggedIn">
            <action execute="#{redirect.captureCurrentView}"/>
         </event>
         <event type="org.jboss.seam.security.loginSuccessful">
            <action execute="#{redirect.returnToCapturedView}"/>
         </event>
      
         <mail:mail-session host="localhost" port="2525" username="test" password="test" />
      
         <!-- For use with jBPM pageflow or process management -->
         <!--
         <bpm:jbpm>
            <bpm:process-definitions></bpm:process-definitions>
            <bpm:pageflow-definitions></bpm:pageflow-definitions>
         </bpm:jbpm>
         -->
         
         <component class="org.jboss.seam.web.MultipartFilter">
          <property name="createTempFiles">true</property>  
          <property name="maxRequestSize">100000000</property>  
         </component>
      
      </components>
      



      Here is a part of one of xhtml files, which is supposed to be translated into pdf:



      <p:document xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:p="http://jboss.com/products/seam/pdf">
         
         <p:paragraph spacingAfter="7">
               <p:font size="12" style="bold"> Zmluva</p:font>
         </p:paragraph>
         
         <p:font family="times-roman"  size="8" encoding="Cp1250">
      
         ...
         
         </p:font>
              
      
          
      </p:document>
      
      




      I am using libraries included with SEAM 2.1.1.GA (iText.jar, jboss-seam-pdf, jboss-seam-ui.jar), I have included them into build path. I have also put these files into WEB-INF/lib directory.


      I still get these error:


      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:92)
           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:196)
           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.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           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:177)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
           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.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           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)
           ... 55 more
      Caused by: java.lang.NoClassDefFoundError: com/lowagie/text/rtf/RtfWriter2
           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)
           ... 56 more



      I am using SEAM about an year now, and I have spent one day with this problem, no effect.


      Thank You for your help in advance.


      Ondrej