Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF2 application not accessible without /faces/

I have a JSF2 application I can access my application @ http://tvmteleshopping.com/faces/ui/manageProfile.xhtml

but when i use http://tvmteleshopping.com/ui/manageProfile.xhtml (without /faces/ ) this request is being served by Apache not tomcat. Any only static HTML content is rendered.

I am using Apache to serve static HTML files and tomcat for serving *.xhtml files

My Servlet mapping is fine: web.xml

  <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>/faces/*</url-pattern>
  </servlet-mapping>
  <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>*.faces</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

My cp_jkmount.conf to redirect jsp and jsf files to tocat server.

<IfModule mod_jk.c>
  JkMount /*.jsp ajp13
  JKMount /*.do ajp13
  JKMount /servlet/* ajp13
  JKMount /servlets/* ajp13
  JKMount /*.xhtml ajp13
  JKMount /ui/* ajp13
  JKMount /ui/*.xhtml ajp13
  JKMount /faces/* ajp13
  JKMount /*.jsf ajp13
</IfModule>

I have two cp_jkmount.conf, one in /usr/local/apache/conf/userdata/std/1/myuser/mysite.com/cp_jkmount.conf

and one in /usr/local/apache/conf/userdata/std/2/myuser/mysite.com/cp_jkmount.conf

And my both cp_jkmount are same. I don't know why i do have two cp_jkmount.conf in two different directories.

P.S: my application is working fine for those .xhtml files which are in root folder http://tvmteleshopping.com/index.xhtml

for this i think my cp_jkmout.conf works fine. But for those .xhtml files behind 'ui' folder it doesn't work.

like image 754
Mohit Saluja Avatar asked May 02 '13 09:05

Mohit Saluja


1 Answers

Why don't you use

http://tvmteleshopping.com/manageProfile.jsf

instead of

http://tvmteleshopping.com/ui/manageProfile.xhml or anything else as the hyperlink?

Let the framework locate the page for you rather than you explicitly mentioning the path.

like image 62
Niks Avatar answered Sep 28 '22 06:09

Niks