Tuesday, July 19, 2016

java.lang.StackOverflowError at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:201)

You may encounter this error while working on upgrading your project from JSF 1.* to 2.0. To err is human, we would have updated all our JAR files, refactored our code to use the latest features and annotations etc. But when you start your server, you will see the error, and it will go in the infinite loop. The issue is because of the we haven't update our faces-config.xml DOCTYPE to use latest version. It should be the in the old version. You have to change the version

From

 <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">  

To

 <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_2_0.xsd"  
   version="2.0">  

Just change the xsd version as above, that's all.

Happy Programming...!!!