0
votes

When updating

  • jsf from 1.2 to 2.1
  • richfaces from 3.3.3 to 4.3.7.Final

following this link

I got stuck with some strange exception

java.lang.NullPointerException
com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.processFacesNavigation(PrettyNavigationHandler.java:58)
com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.handleNavigation(PrettyNavigationHandler.java:44)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
ua.com.winforce.online.site.http.filter.LocaleFilter.doFilter(LocaleFilter.java:65)

which appears after submitting simple form on login.jspx page

<h:form>
<div class="form-group">
    <label for="rLogin"><h:outputText value="#{localeController.locale.registr.email}" escape="false"/></label>
    <h:inputText id="rLogin"  value="#{playerRegistration.login}" />
</div>
<div class="form-group">
    <label for="rPassword"><h:outputText value="#{localeController.locale.registr.password}" escape="false"/></label>
    <h:inputSecret value="#{playerRegistration.password}"/>
</div>
    <h:commandButton value="#{localeController.locale.mainMsg.registration}" action="#{playerRegistration.doRegistration}" />

LocaleFilter works as usual.

After updating I left .jspx page format.

I think that something wrong in configuration but can't find the reason.

main pom.xml:

<properties>
    <targetJdk>1.6</targetJdk>
    <spring.version>4.0.5.RELEASE</spring.version>
    <spring.security.version>3.2.4.RELEASE</spring.security.version>
    <hibernate.version>4.2.16.Final</hibernate.version>
    <richfaces.version>4.3.7.Final</richfaces.version>
</properties>

<dependencyManagement>
    <dependencies>
        <!-- Utils -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>

        <!-- Servlets / JSP / JSTL -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

         <!-- RichFaces libraries -->
        <dependency>
      <groupId>org.richfaces</groupId>
      <artifactId>richfaces-bom</artifactId>
      <version>${richfaces.version}</version>
      <scope>import</scope>
      <type>pom</type>
    </dependency>

    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.core</groupId>
        <artifactId>richfaces-core-impl</artifactId>
      </dependency>
      <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-components-ui</artifactId>
      </dependency>
</dependencies>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<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_3_0.xsd"
     version="3.0">
<mime-mapping>
    <extension>jspx</extension>
    <mime-type>application/xml</mime-type>
</mime-mapping>

<context-param>
    <param-name>javax.faces.application.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.jspx</param-value>
</context-param>    
<context-param>
    <param-name>javax.faces.FACELETS_SUFFIX</param-name>
    <param-value>.jspx</param-value>
</context-param>    
<context-param>
    <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
    <param-value>*.jspx</param-value>
</context-param>

<context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>false</param-value>
</context-param>

<context-param>
        <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
        <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/applicationContext-site-dao.xml
        /WEB-INF/applicationContext-site-security.xml
    </param-value>
</context-param>

<context-param>
    <param-name>com.sun.faces.sendPoweredByHeader</param-name>
    <param-value>false</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<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>*.html</url-pattern>
</servlet-mapping>

faces-config.xml header:

<faces-config version="2.1" 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-facesconfig_2_1.xsd">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<locale-config>
        <default-locale>ru</default-locale>
        <supported-locale>ru</supported-locale>
        <supported-locale>en</supported-locale>
    </locale-config>

Here are libs, used in project:

  • org/graylog2/gelfj/0.9.1-SNAPSHOT/gelfj-0.9.1-SNAPSHOT.jar
  • com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar
  • commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar
  • jcraft/jcraft/1/jcraft-1.jar
  • jazzlib/jazzlib/1.07/jazzlib-1.07.jar
  • net/sf/json-lib/json-lib/2.2.3/json-lib-2.2.3-jdk15.jar
  • net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar
  • javax/mail/mail/1.4.1/mail-1.4.1.jar
  • javax/activation/activation/1.1/activation-1.1.jar
  • license4j-runtime/license4j-runtime/3.1/license4j-runtime-3.1.jar
  • jdbcappender/jdbcappender/2.1.01/jdbcappender-2.1.01.jar
  • log4j/log4j/1.2.14/log4j-1.2.14.jar
  • org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar
  • commons-lang/commons-lang/2.4/commons-lang-2.4.jar
  • commons-io/commons-io/1.4/commons-io-1.4.jar
  • commons-collections/commons-collections/3.2/commons-collections-3.2.jar
  • commons-dbcp/commons-dbcp/1.2.1/commons-dbcp-1.2.1.jar
  • xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
  • xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar
  • commons-discovery/commons-discovery/0.4/commons-discovery-0.4.jar
  • commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
  • javax/servlet/jstl/1.2/jstl-1.2.jar
  • com/sun/facelets/jsf-facelets/1.1.15/jsf-facelets-1.1.15.jar
  • aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar
  • aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar
  • jfree/jcommon/1.0.12/jcommon-1.0.12.jar
  • org/springframework/spring-web/4.0.5.RELEASE/spring-web-4.0.5.RELEASE.jar
  • org/springframework/spring-aop/4.0.5.RELEASE/spring-aop-4.0.5.RELEASE.jar
  • org/springframework/spring-jdbc/4.0.5.RELEASE/spring-jdbc-4.0.5.RELEASE.jar
  • org/springframework/spring-tx/4.0.5.RELEASE/spring-tx-4.0.5.RELEASE.jar
  • org/springframework/spring-orm/4.0.5.RELEASE/spring-orm-4.0.5.RELEASE.jar
  • org/springframework/spring-support/2.0.8/spring-support-2.0.8.jar
  • aopalliance/aopalliance/1.0/aopalliance-1.0.jar
  • org/springframework/security/spring-security-core/3.2.4.RELEASE/spring-security-core-3.2.4.RELEASE.jar
  • org/springframework/spring-expression/3.2.8.RELEASE/spring-expression-3.2.8.RELEASE.jar
  • org/springframework/security/spring-security-config/3.2.4.RELEASE/spring-security-config-3.2.4.RELEASE.jar
  • org/springframework/security/spring-security-taglibs/3.2.4.RELEASE/spring-security-taglibs-3.2.4.RELEASE.jar
  • org/springframework/security/spring-security-acl/3.2.4.RELEASE/spring-security-acl-3.2.4.RELEASE.jar
  • org/springframework/security/spring-security-web/3.2.4.RELEASE/spring-security-web-3.2.4.RELEASE.jar
  • commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar
  • commons-validator/commons-validator/1.2.0/commons-validator-1.2.0.jar
  • commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
  • commons-digester/commons-digester/1.6/commons-digester-1.6.jar
  • oro/oro/2.0.8/oro-2.0.8.jar
  • commons-net/commons-net/3.3/commons-net-3.3.jar
  • javassist/javassist/3.10.0.GA/javassist-3.10.0.GA.jar
  • postgresql/postgresql/8.3-603.jdbc4/postgresql-8.3-603.jdbc4.jar
  • quartz/quartz/1.5.2/quartz-1.5.2.jar
  • org/freemarker/freemarker/2.3.9/freemarker-2.3.9.jar
  • avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar
  • com/sun/xml/messaging/saaj/saaj-impl/1.3.1/saaj-impl-1.3.1.jar
  • javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar
  • com/octo/captcha/jcaptcha-all/1.0-RC6/jcaptcha-all-1.0-RC6.jar
  • javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
  • commons-codec/commons-codec/1.4/commons-codec-1.4.jar
  • org/springframework/spring-core/4.0.5.RELEASE/spring-core-4.0.5.RELEASE.jar
  • com/ocpsoft/prettyfaces-jsf12/3.3.3/prettyfaces-jsf12-3.3.3.jar
  • org/richfaces/core/richfaces-core-impl/4.3.7.Final/richfaces-core-impl-4.3.7.Final.jar
  • org/richfaces/core/richfaces-core-api/4.3.7.Final/richfaces-core-api-4.3.7.Final.jar
  • net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar
  • org/w3c/css/sac/1.3/sac-1.3.jar
  • com/google/guava/guava/13.0.1/guava-13.0.1.jar
  • org/richfaces/ui/richfaces-components-ui/4.3.7.Final/richfaces-components-ui-4.3.7.Final.jar
  • org/richfaces/ui/richfaces-components-api/4.3.7.Final/richfaces-components-api-4.3.7.Final.jar
  • com/sun/faces/jsf-impl/2.1.3/jsf-impl-2.1.3.jar
  • com/sun/faces/jsf-api/2.1.3/jsf-api-2.1.3.jar
  • commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar
  • org/hibernate/hibernate-core/4.2.16.Final/hibernate-core-4.2.16.Final.jar
  • antlr/antlr/2.7.7/antlr-2.7.7.jar
  • org/jboss/logging/jboss-logging/3.1.0.GA/jboss-logging-3.1.0.GA.jar
  • dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
  • org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
  • org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.1.Final/jboss-transaction-api_1.1_spec-1.0.1.Final.jar
  • org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar
  • org/hibernate/common/hibernate-commons-annotations/4.0.2.Final/hibernate-commons-annotations-4.0.2.Final.jar
  • javax/jms/jms-api/1.1-rev-1/jms-api-1.1-rev-1.jar
  • org/apache/xbean/xbean-spring/4.1/xbean-spring-4.1.jar
  • org/apache/activemq/activemq-all/5.12.1/activemq-all-5.12.1.jar
  • org/springframework/spring-jms/4.0.5.RELEASE/spring-jms-4.0.5.RELEASE.jar
  • joda-time/joda-time/2.7/joda-time-2.7.jar
  • org/springframework/spring-context-support/4.0.5.RELEASE/spring-context-support-4.0.5.RELEASE.jar
  • org/springframework/spring-beans/4.0.5.RELEASE/spring-beans-4.0.5.RELEASE.jar
  • org/springframework/spring-context/4.0.5.RELEASE/spring-context-4.0.5.RELEASE.jar
  • net/sf/ehcache/ehcache/2.10.0/ehcache-2.10.0.jar
  • org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
  • javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar
  • wsdl4j/wsdl4j/1.6.1/wsdl4j-1.6.1.jar

I am ready to add any extra information to find a reason of this situation. I hope someone can help me to find out how to solve this problem, because Google doesn't know about this issue. Any help will be useful.

2
It sounds like #{playerRegistration.doRegistration} is returning a navigation case which doesn't exist. Anyway, try to update the Prettyfaces ersion.Xtreme Biker

2 Answers

0
votes

Change prettyfaces to JSF 2 compatible version (for example prettyfaces-jsf2-3.3.3.jar)

prettyfaces-jsf12... is for JSF 1.2, prettyfaces-jsf2... is for JSF 2.x (from OCPSoft doc)

, check if it proper defined in your project. Plus you can add following filter in web.xml:

<filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>Pretty Filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>
0
votes

the problem was in the following dependency

com/ocpsoft/prettyfaces-jsf12/3.3.3/prettyfaces-jsf12-3.3.3.jar

when I replaced it with

com/ocpsoft/prettyfaces-jsf2/3.3.3/prettyfaces-jsf2-3.3.3.jar

for the second version of JSF, the problem has gone