JSF: NullPointerException at FacesServlet.init line 144 / Can't parse faces-config.xml - SocketException

Problem

When deploying JSF 1.1 application to WebSphere 6.0 I got the following not much helpful exception:

java.lang.NullPointerException
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:144)

Checking SystemErr.log revealed the following explanation:

javax.faces.FacesException: Can't parse configuration file:file:/usr/WebSphere/AppServer/profiles/profileNode1/installedApps/
a25ciwas005Network/jholy-GroovyConsole_temp.ear/GroovyConsole.war/WEB-INF/faces-config.xml
...
Caused by: java.net.SocketException: Connection timed out:could be due to invalid address

The explanation is that the XML parser cannot access http://java.sun.com/dtd/web-facesconfig_1_1.dtd referenced from the config file, presumabely due to firewall setup.

I should say that I've  jsf-api.jar and jsf-impl.jar in the webapp.

Solution

The solution is either to provide the DTD locally or perhaps to remove the <!DOCTYPE ..> declaration from the file. I've

1. downloaded the dtd and put it to WEB-INF/web-facesconfig_1_1.dtd and

2. modified the doctype declaration as follows:

<!DOCTYPE faces-config SYSTEM "web-facesconfig_1_1.dtd">

Voila, few hours of wasted time and problem is solved. I wish the responsible developer has thought a bit more.



Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob