2 Replies Latest reply on Mar 8, 2013 4:49 AM by hantsy bai

    java.lang.InstantiationException was occured when upgraded to Richfaces 4.3

    hantsy bai Master

      I have a  Java EE application, which used Richfaces 4.2.0.Final, JBoss7.1.1.Final, Seam3.1.

       

      When I changed the version of Richfaces to 4.3.0.Final, I encoutered the following exception frequently when browsed the pages. It seems it is not caused by my codes, but some incompitiablity in the dependencies in my application.

       

      Is this a bug of Richfaces? or caused by other parts?

       

      java.lang.InstantiationException: com.sun.faces.facelets.compiler.UIInstructions
       java.lang.Class.newInstance0(Class.java:359)
       java.lang.Class.newInstance(Class.java:327)
       com.sun.faces.application.StateManagerImpl.newInstance(StateManagerImpl.java:296)
       com.sun.faces.application.StateManagerImpl.restoreTree(StateManagerImpl.java:326)
       com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:203)
       com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
       com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
       com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
       com.ocpsoft.pretty.faces.application.PrettyViewHandler.restoreView(PrettyViewHandler.java:109)
       javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
       javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
       javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
       com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
       com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
       com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
       com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
       com.company.component.fileUpload.MultipartFilter.doFilter(MultipartFilter.java:63)
       org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
       org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
       org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
      
        • 1. Re: java.lang.InstantiationException was occured when upgraded to Richfaces 4.3
          Juraj Húska Master

          Hi,

           

          can you please share with us you pom.xml and web.xml ? Or have already you solved your problem ?

          • 2. Re: java.lang.InstantiationException was occured when upgraded to Richfaces 4.3
            hantsy bai Master

            Juraj Húska wrote:

             

            Hi,

             

            can you please share with us you pom.xml and web.xml ? Or have already you solved your problem ?

             

            The pom.xml

             

            <?xml version="1.0" encoding="UTF-8" standalone="no"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
                <modelVersion>4.0.0</modelVersion>
                <groupId>com.company</groupId>
                <artifactId>tickler</artifactId>
                <version>1.0-SNAPSHOT</version>
                <packaging>war</packaging>
                <name>Tickler Web App</name>
            
                <properties>
                    <webapp.directory>src/main/webapp</webapp.directory>
                    <jboss.home>${env.JBOSS_HOME}</jboss.home>
                    <jboss.domain>default</jboss.domain>
                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                    <version.jboss-javaee6-spec>3.0.1.Final</version.jboss-javaee6-spec>
                    <version.seam>3.1.0.Final</version.seam>
                    <version.jbossas>7.1.1.Final</version.jbossas>
                    <version.richfaces> 4.2.0.Final</version.richfaces>
                    <version.jpamodelgen>1.1.1.Final</version.jpamodelgen>
                    <version.arquillian_core>1.0.2.Final</version.arquillian_core>
                    <!-- <version.primefaces>3.4.RC1</version.primefaces> <version.primefaces-extensions>0.6.0-SNAPSHOT</version.primefaces-extensions> -->
                </properties>
                <dependencyManagement>
                    <dependencies>
                        <dependency>
                            <groupId>org.jboss.seam</groupId>
                            <artifactId>seam-bom</artifactId>
                            <version>${version.seam}</version>
                            <type>pom</type>
                            <scope>import</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.richfaces</groupId>
                            <artifactId>richfaces-bom</artifactId>
                            <version>${version.richfaces}</version>
                            <type>pom</type>
                            <scope>import</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.jboss.arquillian</groupId>
                            <artifactId>arquillian-bom</artifactId>
                            <version>${version.arquillian_core}</version>
                            <type>pom</type>
                            <scope>import</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.jboss.spec</groupId>
                            <artifactId>jboss-javaee-6.0</artifactId>
                            <version>${version.jboss-javaee6-spec}</version>
                            <type>pom</type>
                            <scope>import</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.hibernate</groupId>
                            <artifactId>hibernate-entitymanager</artifactId>
                            <version>4.1.0.Final</version>
                            <scope>provided</scope>
                        </dependency>
                    </dependencies>
                </dependencyManagement>
                <dependencies>
                    <dependency>
                        <groupId>org.jboss.solder</groupId>
                        <artifactId>solder-api</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.solder</groupId>
                        <artifactId>solder-impl</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.solder</groupId>
                        <artifactId>solder-logging</artifactId>
                        <version>${version.seam}</version>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.seam.faces</groupId>
                        <artifactId>seam-faces</artifactId>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.seam.conversation</groupId>
                        <artifactId>seam-conversation-spi</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.conversation</groupId>
                        <artifactId>seam-conversation-weld</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.international</groupId>
                        <artifactId>seam-international</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.mail</groupId>
                        <artifactId>seam-mail-api</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.mail</groupId>
                        <artifactId>seam-mail</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.velocity</groupId>
                        <artifactId>velocity</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.transaction</groupId>
                        <artifactId>seam-transaction</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.persistence</groupId>
                        <artifactId>seam-persistence</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.security</groupId>
                        <artifactId>seam-security-api</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.security</groupId>
                        <artifactId>seam-security</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.reports</groupId>
                        <artifactId>seam-reports-api</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.seam.reports</groupId>
                        <artifactId>seam-reports-jasper</artifactId>
                        <scope>compile</scope>
                    </dependency>
            
                    <dependency>
                        <groupId>org.jboss.seam.jms</groupId>
                        <artifactId>seam-jms</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.seam.jms</groupId>
                        <artifactId>seam-jms-api</artifactId>
                        <scope>compile</scope>
                    </dependency>
                    
            
                    <dependency>
                        <groupId>net.sf.jasperreports</groupId>
                        <artifactId>jasperreports</artifactId>
                        <version>4.1.2</version>
                        <scope>compile</scope>
                        <exclusions>
                            <exclusion>
                                <artifactId>dom4j</artifactId>
                                <groupId>dom4j</groupId>
                            </exclusion>
                            <exclusion>
                                <artifactId>bcmail-jdk14</artifactId>
                                <groupId>bouncycastle</groupId>
                            </exclusion>
                            <exclusion>
                                <artifactId>bcprov-jdk14</artifactId>
                                <groupId>bouncycastle</groupId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>com.ocpsoft</groupId>
                        <artifactId>ocpsoft-pretty-time</artifactId>
                    </dependency>
            
                    <dependency>
                        <groupId>com.ocpsoft</groupId>
                        <artifactId>prettyfaces-jsf2</artifactId>
                    </dependency>
            
                    <dependency>
                        <groupId>com.sun.faces</groupId>
                        <artifactId>jsf-api</artifactId>
                        <version>2.1.6</version>
                        <scope>provided</scope>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.faces</groupId>
                        <artifactId>jsf-impl</artifactId>
                        <version>2.1.6</version>
                        <scope>provided</scope>
                    </dependency>
                    <dependency>
                        <groupId>commons-digester</groupId>
                        <artifactId>commons-digester</artifactId>
                        <version>2.1</version>
                    </dependency>
            
                    <dependency>
                        <groupId>commons-io</groupId>
                        <artifactId>commons-io</artifactId>
                        <version>2.1</version>
                    </dependency>
            
                    <dependency>
                        <groupId>commons-fileupload</groupId>
                        <artifactId>commons-fileupload</artifactId>
                        <version>1.2.2</version>
                    </dependency>
            
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-validator</artifactId>
                        <version>4.2.0.Final</version>
                        <scope>provided</scope>
                        <exclusions>
                            <exclusion>
                                <artifactId>slf4j-api</artifactId>
                                <groupId>org.slf4j</groupId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-jpamodelgen</artifactId>
                        <version>${version.jpamodelgen}</version>
                        <scope>provided</scope>
                        <exclusions>
                            <exclusion>
                                <artifactId>hibernate-jpa-2.0-api</artifactId>
                                <groupId>org.hibernate.javax.persistence</groupId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>joda-time</groupId>
                        <artifactId>joda-time</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>javax.enterprise</groupId>
                        <artifactId>cdi-api</artifactId>
                        <scope>provided</scope>
                    </dependency>
            
                    <!-- <dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> 
                        <version>2.2</version> </dependency> -->
            
                    <dependency>
                        <groupId>org.richfaces.ui</groupId>
                        <artifactId>richfaces-components-ui</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.richfaces.core</groupId>
                        <artifactId>richfaces-core-impl</artifactId>
                    </dependency>
                    <!-- <dependency> <groupId>org.richfaces.sandbox.ui.bootstrap</groupId> 
                        <artifactId>bootstrap-ui</artifactId> <version>${version.richfaces}</version> 
                        </dependency> -->
                    <!-- <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> 
                        <version>${version.primefaces}</version> </dependency> <dependency> <groupId>org.primefaces.extensions</groupId> 
                        <artifactId>primefaces-extensions</artifactId> <version>${version.primefaces-extensions}</version> 
                        </dependency> -->
                    <dependency>
                        <groupId>org.jboss.spec</groupId>
                        <artifactId>jboss-javaee-6.0</artifactId>
                        <version>${version.jboss-javaee6-spec}</version>
                        <type>pom</type>
                        <scope>provided</scope>
            
                    </dependency>
                    <dependency>
                        <artifactId>jboss-jms-api_1.1_spec</artifactId>
                        <groupId>org.jboss.spec.javax.jms</groupId>
                        <scope>provided</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.spec.javax.servlet</groupId>
                        <artifactId>jboss-servlet-api_3.0_spec</artifactId>
                        <version>1.0.0.Final</version>
                        <scope>provided</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                        <version>1.6.2</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.16</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>4.8.2</version>
                        <scope>test</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.jboss.arquillian.junit</groupId>
                        <artifactId>arquillian-junit-container</artifactId>
                        <scope>test</scope>
                    </dependency>
            
                    <dependency>
                        <groupId>org.jboss.shrinkwrap.resolver</groupId>
                        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
                        <scope>test</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>1.6.2</version>
                        <scope>compile</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-entitymanager</artifactId>
                        <scope>provided</scope>
                    </dependency>
                    <dependency>
                        <groupId>org.omnifaces</groupId>
                        <artifactId>omnifaces</artifactId>
                        <version>1.1</version>
                    </dependency>
                    <dependency>
                        <groupId>org.atmosphere</groupId>
                        <artifactId>atmosphere-runtime</artifactId>
                    </dependency>
                </dependencies>
                <repositories>
                    <!-- <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name> 
                        <url>http://repository.primefaces.org</url> <layout>default</layout> </repository> -->
                    <repository>
                        <releases>
                            <enabled>true</enabled>
                            <updatePolicy>daily</updatePolicy>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                            <updatePolicy>daily</updatePolicy>
                        </snapshots>
                        <id>jboss-public-repository-group</id>
                        <name>JBoss Public Maven Repository Group</name>
                        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <releases>
                            <enabled>true</enabled>
                            <updatePolicy>daily</updatePolicy>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                            <updatePolicy>daily</updatePolicy>
                        </snapshots>
                        <id>jboss-public-repository-group</id>
                        <name>JBoss Public Maven Repository Group</name>
                        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
                    </pluginRepository>
                </pluginRepositories>
                <build>
                    <defaultGoal>package</defaultGoal>
                    <finalName>${project.artifactId}</finalName>
                    <plugins>
                        <plugin>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <version>2.3.2</version>
                            <configuration>
                                <source>1.6</source>
                                <target>1.6</target>
                            </configuration>
                        </plugin>
                        <plugin>
                            <artifactId>maven-war-plugin</artifactId>
                            <version>2.1.1</version>
                            <configuration>
                                <failOnMissingWebXml>false</failOnMissingWebXml>
                            </configuration>
                        </plugin>
                        <plugin>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>2.11</version>
                            <configuration>
                                <skip>true</skip>
                            </configuration>
                        </plugin>
            
                        <plugin>
                            <groupId>org.jboss.as.plugins</groupId>
                            <artifactId>jboss-as-maven-plugin</artifactId>
                            <version>${version.jbossas}</version>
                            <extensions>false</extensions>
                        </plugin>
                    </plugins>
                </build>
                <profiles>
                    <profile>
                        <id>jboss7</id>
                        <activation>
                            <activeByDefault>true</activeByDefault>
                        </activation>
                        <build>
                            <plugins>
                                <plugin>
                                    <artifactId>maven-war-plugin</artifactId>
                                    <configuration>
                                        <webResources>
                                            <resource>
                                                <directory>src/main/resources-jboss7</directory>
                                            </resource>
                                        </webResources>
                                    </configuration>
                                </plugin>
                                <plugin>
                                    <groupId>org.jboss.as.plugins</groupId>
                                    <artifactId>jboss-as-maven-plugin</artifactId>
                                    <version>${version.jbossas}</version>
                                </plugin>
                            </plugins>
                        </build>
                    </profile>
            
                    <profile>
                        <!-- When built in OpenShift the openshift profile will be used when invoking 
                            mvn. -->
                        <!-- Use this profile for any OpenShift specific customization your app 
                            will need. -->
                        <!-- By default that is to put the resulting archive into the deployments 
                            folder. -->
                        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
                        <id>openshift</id>
                        <build>
                            <finalName>tickler</finalName>
                            <plugins>
                                <plugin>
                                    <artifactId>maven-war-plugin</artifactId>
                                    <version>2.1.1</version>
                                    <configuration>
                                        <outputDirectory>deployments</outputDirectory>
                                        <warName>ROOT</warName>
                                        <webResources>
                                            <resource>
                                                <directory>src/main/resources-openshift</directory>
                                            </resource>
                                        </webResources>
                                    </configuration>
                                </plugin>
                            </plugins>
                        </build>
                    </profile>
                </profiles>
            </project>
            

             

            Web.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="3.0" 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_3_0.xsd">
                <context-param>
                    <param-name>javax.faces.PROJECT_STAGE</param-name>
                    <param-value>Development</param-value>
                </context-param>
                <!--<context-param> <param-name>javax.faces.SEPARATOR_CHAR</param-name> 
                    <param-value>_</param-value> </context-param> -->
            
                <context-param>
                    <param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
                    <param-value>/WEB-INF/tickler.taglib.xml</param-value>
                </context-param>
                <context-param>
                    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
                    <param-value>true</param-value>
                </context-param>
                <context-param>
                    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
                    <param-value>false</param-value>
                </context-param>
            
                <context-param>
                    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                    <param-value>server</param-value>
                </context-param>
                <context-param>
                    <param-name>om.sun.faces.writeStateAtFormEnd</param-name>
                    <param-value>false</param-value>
                </context-param>
                <!-- Richfaces config -->
                <context-param>
                    <param-name>org.richfaces.enableControlSkinning</param-name>
                    <param-value>false</param-value>
                </context-param>
                <context-param>
                    <param-name>org.richfaces.skin</param-name>
                    <param-value>plain</param-value>
                </context-param>
                <!-- <context-param> <param-name>org.richfaces.resourceOptimization.enabled</param-name> 
                    <param-value>true</param-value> </context-param> -->
                <filter>
                    <filter-name>Upload Filter</filter-name>
                    <filter-class>com.company.component.fileUpload.MultipartFilter</filter-class>
                </filter>
                <filter-mapping>
                    <filter-name>Upload Filter</filter-name>
                    <servlet-name>Faces Servlet</servlet-name>
                </filter-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>*.xhtml</url-pattern>
                </servlet-mapping>
                <session-config>
                    <session-timeout>30</session-timeout>
                </session-config>
                <mime-mapping>
                    <extension>ico</extension>
                    <mime-type>image/x-icon</mime-type>
                </mime-mapping>
                <mime-mapping>
                    <extension>less</extension>
                    <mime-type>text/css</mime-type>
                </mime-mapping>
                <mime-mapping>
                    <extension>woff</extension>
                    <mime-type>application/x-font-woff</mime-type>
                </mime-mapping>
                <welcome-file-list>
                    <welcome-file>index.html</welcome-file>
                </welcome-file-list>
                <error-page>
                    <error-code>404</error-code>
                    <location>/404.xhtml</location>
                </error-page>
                <!-- <error-page> <error-code>500</error-code> <location>/500.xhtml</location> 
                    </error-page> -->
            </web-app>