0

I have made a web app with JSF and am running it on Tomcat.

In the webapp, there are several URLs that are created dynamically. For example, /ny/ is not a folder under the root (WebContent) folder. When a user requests for /ny/, a PhaseListener sets the viewId to a certain page. There is no error in rendering the resulting page.

But, I get this warning in tomcat's catalina.out file:

WARNING: JSF1091: No mime type could be found for file /ny/home.jsp. To resolve this, add a mime-type mapping to the applications web.xml.

I have two questions about this:

1) Why is tomcat looking for a .jsp file, when I have not used .jsp files anywhere in my app? I don't have a mapping for .jsp files anywhere in the web.xml file either.

2) How do I get tomcat to look for /ny/home.jsf instead of /ny/home.jsp OR otherwise how do I prevent tomcat from logging this in catalina.out ?

My web.xml file is as below:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<welcome-file-list>
    <welcome-file>home.jsf</welcome-file>
    <welcome-file>index.php</welcome-file>
    </welcome-file-list>
<session-config>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>
<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>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>
<security-constraint>
    <display-name>Restrict access to Facelets source code.</display-name>
    <web-resource-collection>
        <web-resource-name>Facelets</web-resource-name>
        <url-pattern>*.xhtml</url-pattern>
    </web-resource-collection>
    <auth-constraint/>
</security-constraint>
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
</context-param>
<context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
</context-param>
<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
    <welcome-file>home.jsf</welcome-file>
    <welcome-file>index.jsf</welcome-file>
    <welcome-file>welcome.jsf</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.php</welcome-file>
</welcome-file-list>
<context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>
</web-app>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mahendra
  • 33
  • 1
  • 7
  • Which JSF impl/version? – BalusC Apr 02 '15 at 05:38
  • I am on mojarra 2.2, tomcat7. I have javax.faces.jar and jstl-1.2.jar in the /WEB-INF/lib folder. – Mahendra Apr 02 '15 at 08:45
  • OK, impl is thus Mojarra. But which Mojarra version exactly? "2.2" is just a JSF spec version and not a specific impl version. Current latest Mojarra 2.2 version is 2.2.10. – BalusC Apr 02 '15 at 08:58
  • I referenced the answer to http://stackoverflow.com/questions/20083068/how-to-find-out-the-current-version-of-mojarra-which-my-weblogic-is-using to find out my implementation version. It was Mojarra 2.2.0 – Mahendra Apr 02 '15 at 09:44
  • That's relatively old. Give the current version a try so you can exclude it being caused by an already fixed bug. – BalusC Apr 02 '15 at 09:55
  • Thanks for the quick reply. How do I get the latest version? I am on Eclipse Luna, and the one it gives me by default is Mojarra 2.2.0. Also, do I just download Mojarra 2.2.10 and drop it's jar file into WEB-INF/lib? – Mahendra Apr 02 '15 at 19:39
  • The IDE is just a loaded text editor trying to make things easier for starters. Yes, just download it from [Mojarra homepage](http://javaserverfaces.java.net) and drop in `/WEB-INF/lib`. Don't forget to remove the Eclipse-included user library in project's properties. – BalusC Apr 02 '15 at 19:41
  • Using Mojarra 2.2.10 resolved the problem. I just deleted the existing javax.faces.jar from WEB-INF/lib and put in the javax.faces-2.2.10.jar ..... Thanks a lot. – Mahendra Apr 03 '15 at 20:29
  • Now that the issue is resolved, how do I accept your comment as an answer? – Mahendra Apr 03 '15 at 20:31
  • I'll repost it as an answer. – BalusC Apr 07 '15 at 06:10

1 Answers1

1

This appears to be a bug in Mojarra 2.2.0 (released May 2013) which is solved in at least Mojarra 2.2.10 (released Feb 2015). So, upgrading to at least that version should do it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555