Short intro:
Im trying to deploy a jsf 2.1 project on Jboss AS 7 (tryed also on Tomcat 7). The deploy is working without any issues but when I try to access the site css, images and javascript cannot be found and I get tons of the following exception type from the logs:
0:04:58,261 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[Faces Servlet]] (http--127.0.0.1-8080-21) Servlet.service() for servlet Faces Servlet threw exception: com.sun.faces.context.FacesFileNotFoundException: /projectName/rfRes/calendarIcon.png.xhtml Not Found in ExternalContext as a Resource
In the browser it looks like:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
In the template an image for example looks like:
<h:graphicImage library="images" name="logo.png" />
The generated path from faces to resources:
<img src="/projectName/javax.faces.resource/logo.png.xhtml;jsessionid=30AEAD88CADB047E3DFBDDA372732F08?ln=images">
Path to images:
WebContent/resources/images
I have tryed to deploy it with different configurations: Jboss 7.0/7.1, Tomcat 6/7, Java 6/7. But it works only for my local deployment and not for the debian. One solution would be to just put everywhere the direct path to the resources without using jsf but what to do with richfaces images and everything... .
Project and System configuration:
Java 7
Hibernate 3
Jsf 2.1
Richfaces 4.2
Debian 6
faces config
<?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_2_0.xsd"
version="2.0">
<application>
<locale-config>
<default-locale>en_EN</default-locale>
</locale-config>
<resource-bundle>
<base-name>language</base-name>
<var>language</var>
</resource-bundle>
<factory>
<exception-handler-factory>
package.ViewExceptionHandlerFactory
</exception-handler-factory>
</factory>
<lifecycle>
<phase-listener>package.AuthListener</phase-listener>
</lifecycle>
</application>
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app metadata-complete="true" id="WebApp_ID" version="3.0"
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">
<display-name>Name</display-name>
<servlet id="JSF_Front_Controller_Servlet">
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>package.services</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<filter>
<display-name>AuthFilter</display-name>
<filter-name>AuthFilter</filter-name>
<filter-class>package.AuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/view/user/*</url-pattern>
</filter-mapping>
<filter>
<display-name>HibernateFilter</display-name>
<filter-name>HibernateFilter</filter-name>
<filter-class>package.HibernateFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>package.HibernateListener</listener-class>
</listener>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>view/start.xhtml</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>shadow</web-resource-name>
<url-pattern>/services/payment/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
</web-app>
Update 1
It seems to be an server issue. Im running debian 6 with apache2 and the following virtual host:
<VirtualHost *:80>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
RewriteEngine On
ProxyPreserveHost On
RewriteRule ^/(.*)$ http://127.0.0.1:8080/project-name/$1 [P]
ServerName url.com
</VirtualHost>
The rewriterule is somehow problematic for jsf