1

When using PrimeFaces and faces-config together, I get a NullPointerException. Before adding faces-config.xml, everything worked fine. After I added faces-config.xml for changing navigation, I got the following Error when calling every page:

java.lang.NullPointerException
  org.primefaces.context.PrimeFacesContext.release(PrimeFacesContext.java:26)
  javax.faces.webapp.FacesServlet.service(FacesServlet.java:612)
  org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
  de.mypackage.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:19)

The CharacterEncodingFilter just ensures usage of UTF-8:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
    request.setCharacterEncoding("UTF-8");
    chain.doFilter(request, response);
}

So this can't be an error source. The faces-config.xml contains the following text:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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_1_2.xsd"
version="1.2">
<navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
        <from-outcome>index</from-outcome>
        <to-view-id>/index.jsf</to-view-id>
    </navigation-case>
</navigation-rule>

This should direct every link to index to one index.jsf, not regarding in which folder the current site is. But if the faces-config.xml is just like this:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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_1_2.xsd"
version="1.2">

the same error appears.

Everything is running on Tomcat 7.

The search for the error did not contain much results, in http://forum.primefaces.org/viewtopic.php?f=3&t=30109&start=10 someone seems to have the same problem with an old release of PrimeFaces 4.0, but as I'm getting it from maven, this can't be my error.

Has anybody an hint how to solve this problem?

David Georg Reichelt
  • 963
  • 1
  • 15
  • 36

2 Answers2

1

The issue can be related to using JBoss Seam Mail and PrimeFaces 4.0:

http://forum.primefaces.org/viewtopic.php?f=3&t=34653

In my case, I used the PrimeFaces v3.4.2 and all worked perfectly.

After upgrade to official maven's PrimeFaces v4.0 the same NPE appears.

My faces-config.xml: <faces-config version="2.1">

0

Indeed, Primefaces 4 doesn't work with JSF 1.2 but it does work with JSF prior to 2.2.

From the Primefaces documentation:

PrimeFaces 4.0 supports JSF 2.0, 2.1 and 2.2 runtimes at the same time using feature detection and by not having compile time dependency to a specific version. As a result some features are only available depending on the runtime.

spauny
  • 4,976
  • 9
  • 44
  • 61