2 Replies Latest reply on Oct 13, 2010 6:30 PM by chris49324

    Can't get JSF2+Facelets+RichFaces to work...

    chris49324

      hey,

      I have some trouble getting JSF2 (MyFaces impl), Facelets and Richfaces (3.3.3.Final) to work.  When I try to access a jsf resource I get an 404. No Message in Glassfish console, no details in Browser. Earlier today with a slightly different configuration the resource was available but the page didn't render at all, only Text did show up in Browser.

       

      And I user Maven.

       

      My current pom:

       

      <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <groupId>de.123</groupId>
          <artifactId>123</artifactId>
          <packaging>war</packaging>
          <name>123</name>
          <version>1.0-SNAPSHOT</version>
          <build>
              <finalName>123</finalName>
              <plugins>
                  <plugin>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <configuration>
                          <source>1.6</source>
                          <target>1.6</target>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-javadoc-plugin</artifactId>
                      <version>2.7</version>
                  </plugin>
              </plugins>
          </reporting>
          <dependencies>
              <dependency>
                  <groupId>jstl</groupId>
                  <artifactId>jstl</artifactId>
                  <version>1.1.2</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.myfaces.core</groupId>
                  <artifactId>myfaces-api</artifactId>
                  <version>2.0.2</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.myfaces.core</groupId>
                  <artifactId>myfaces-build</artifactId>
                  <version>1.2.4</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.myfaces.core</groupId>
                  <artifactId>myfaces-impl</artifactId>
                  <version>2.0.2</version>
              </dependency>
              <dependency>
                  <groupId>javax.el</groupId>
                  <artifactId>el-api</artifactId>
                  <version>1.0</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>el-impl</groupId>
                  <artifactId>el-impl</artifactId>
                  <version>1.0</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>com.sun.facelets</groupId>
                  <artifactId>jsf-facelets</artifactId>
                  <version>1.1.14</version>
              </dependency>
          <!-- RichFaces libraries -->
              <dependency>
                  <groupId>org.richfaces.framework</groupId>
                  <artifactId>richfaces-impl-jsf2</artifactId>
                  <version>3.3.3.Final</version>
              </dependency>
              <dependency>
                  <groupId>org.richfaces.ui</groupId>
                  <artifactId>richfaces-ui</artifactId>
                  <version>3.3.3.Final</version>
              </dependency>
      
              <!-- Hibernate libraries -->
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate</artifactId>
                      <version>3.2.5.ga</version>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-tools</artifactId>
                      <version>3.2.3.GA</version>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-commons-annotations</artifactId>
                      <version>3.3.0.ga</version>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-validator</artifactId>
                      <version>4.0.2.GA</version>
                  </dependency>
                  <dependency>
                      <groupId>javax.sql</groupId>
                      <artifactId>jdbc-stdext</artifactId>
                      <version>2.0</version>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-annotations</artifactId>
                      <version>3.4.0.GA</version>
                      <type>jar</type>
                  </dependency>
              </dependencies>
      
              <repositories>
                  <repository>
                      <id>repository.jboss.com</id>
                      <name>Jboss Repository for Maven</name>
                      <url>http://repository.jboss.com/maven2/</url>
                      <layout>default</layout>
                  </repository>
                  <repository>
                      <url>http://download.java.net/maven/2/</url>
                      <id>hibernate-persistence</id>
                      <layout>default</layout>
                      <name>Repository for library Library[hibernate-persistence]</name>
                  </repository>
              </repositories>
          </project>
      

       

      My web.xml:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" 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_2_5.xsd">
          <display-name>Boombox</display-name>
          <distributable/>
          <context-param>
              <param-name>javax.faces.CONFIG_FILES</param-name>
              <param-value>/WEB-INF/faces-config.xml</param-value>
          </context-param>
          <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>server</param-value>
          </context-param>
          <context-param>
              <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
              <param-value>true</param-value>
          </context-param>
          <context-param>
              <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
              <param-value>com.sun.facelets.FaceletViewHandler</param-value>
          </context-param>
          <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>
          <session-config>
              <session-timeout>30</session-timeout>
          </session-config>
          <login-config>
              <auth-method>BASIC</auth-method>
          </login-config>
      </web-app>
      

       

       

      And finally my faces-config:

       

       

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE faces-config PUBLIC
        "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
        "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      
      <faces-config>
          <application>
              <view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
          </application>
      </faces-config>
      
        • 1. Re: Can't get JSF2+Facelets+RichFaces to work...
          ilya_shaikovsky

          there is a way to get full application starting log. I can't look right now (has no glaafish downloaded after reinstalling the environment) but there are some item e.g. "view server console" in Eclipse servers menu. That console contains more info than available on basic output shown on server start. please check it.

          • 2. Re: Can't get JSF2+Facelets+RichFaces to work...
            chris49324

            i meant that console, but there are just info-messages. no errors:

             

            INFO: Mojarra 2.0.2 (FCS b10) für Kontext '/xy' wird initialisiert.
            INFO: Loading application de.xy_xy_war_1.0-SNAPSHOT at /Boombox
            INFO: de.xy_xy_war_1.0-SNAPSHOT was successfully deployed in 6.514 milliseconds.

             

            ok, i solved this problem by copying a working web.xml and faces-config from someone else.

            BUT, now i have another problem (seems like you always have trouble with JSF in some way)

            Fortunatly, I get an Error this time: Tag Library supports namespace, but no tag was defined for name _INSERT_RANDOM_JSF2_ONLY_TAG_HERE_

            Apparently, the wrong jsf impl (or is it Facelets?) version is running. But there is no jsf-impl in the lib folder, i have no clue whats going on.