[jboss-user] [Beginners Corner] - JBoss 4.0.5 servlet filter problem in web.xml

rayymlai do-not-reply at jboss.com
Tue Oct 31 15:10:26 EST 2006


I write a simple JSF hello world page index.jsp and deploy to JBoss 4.0.5. it seems that JBoss can only accept .faces extension, despite I define the Faces servlet filter with *.jsp.

Setup
1. My simple JSF apps has only one page index.jsp,
which is a simple hello world app, e.g.






Hello world, hi there.




2. I have a simple web.xml that defines the servlet filter with *.jsp (instead of .faces).
e.g.
<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
                             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
                             

    <display-name>xxx</display-name>
    
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

    <!-- Welcome File List -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    
</web-app>

3. A simple, vanilla faces-config.xml
e.g.
<?xml version="1.0" encoding="UTF-8"?>

<faces-config>
    
        <locale-config>
            <default-locale>en</default-locale>
        </locale-config>
    
</faces-config>


Problems
1. upon successful deployment to JBoss, if I type
http://localhost:8080/xxx/index.jsp

JBoss will generate "non-stoppable" exceptions in the server console for a few minutes, and ends up with an exception on the Web browser:

exception 

javax.servlet.ServletException: javax.servlet.ServletException
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause 

javax.faces.FacesException: javax.servlet.ServletException
	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)



2. if I type
http://localhost:8080/xxx/index.faces

the system will work and show hello world message.

Note: if I put *.faces in the faces servlet filter in the web.xml, the system will work as well.

3. JBoss does not seem to accept the faces servlet with a non-*.faces entry. I understand that *.faces is a recommended practice from the JSF spec, but in reality, many people use *.jsf or even *.jsp in the servlet filter.

Implication - I can only use *.faces in the URL for JSF apps.

Could anyone tell me whether I miss anything, or whether this is a specific JBoss implementation?

Thanks




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982203#3982203

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982203



More information about the jboss-user mailing list