1 Reply Latest reply on Jul 6, 2012 11:26 AM by Sanjeev Shrestha

    Richfaces 4.2.2.Final and Glassfish 3.1.2 problems!

    Moreno Novelli Newbie

      Hello, I have a problem witch Richfaces 4.2.2.Final application deployed into Glassfish 3.1.2. Richfaces resources are not loaded in head tag and the page shows the following script tag include:

       

      <script type="text/javascript" src="RES_NOT_FOUND"></script>

       

      I have created an war maven project. I think they have some problems in pom.xml configuration (compilation and deploy successfully!) or web.xml.

       

      This is pom.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <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/xsd/maven-4.0.0.xsd">

       

          <modelVersion>4.0.0</modelVersion>

       

          <parent>

              <groupId>MYGROUP</groupId>

              <artifactId>MYPARENT</artifactId>

              <version>1.3-SNAPSHOT</version>

          </parent>

       

          <groupId>MYGROUP</groupId>

          <artifactId>${projectName}-web-prova</artifactId>

          <packaging>war</packaging>

          <version>1.3-SNAPSHOT</version>

          <name>${appName} - Web Module Richfaces 4.x</name>

         

       

          <properties>       

              <org.richfaces.bom.version>4.2.2.Final</org.richfaces.bom.version>

              <gae.version>1.4.2</gae.version>

          </properties>

       

       

          <dependencyManagement>

              <dependencies>

                  <dependency>

                      <groupId>org.richfaces</groupId>

                      <artifactId>richfaces-bom</artifactId>

                      <version>${org.richfaces.bom.version}</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

              </dependencies>

          </dependencyManagement>

       

          <dependencies>

              <dependency>

                  <groupId>org.richfaces.ui</groupId>

                  <artifactId>richfaces-components-api</artifactId>          

              </dependency>

              <dependency>

                  <groupId>org.richfaces.ui</groupId>

                  <artifactId>richfaces-components-ui</artifactId>           

              </dependency>

              <dependency>

                  <groupId>javax.servlet</groupId>

                  <artifactId>servlet-api</artifactId>

                  <version>3.0-alpha-1</version>         

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.servlet.jsp</groupId>

                  <artifactId>jsp-api</artifactId>           

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.el</groupId>

                  <artifactId>el-api</artifactId>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.servlet</groupId>

                  <artifactId>jstl</artifactId>

                  <version>1.2</version>

              </dependency>

              <dependency>

                   <groupId>org.hibernate</groupId>

                   <artifactId>hibernate-validator</artifactId>

                   <version>4.1.0.Final</version>

              </dependency>

              <dependency>

                   <groupId>javax.validation</groupId>

                   <artifactId>validation-api</artifactId>

                   <version>1.0.0.GA</version>

              </dependency>

              <dependency>

                   <groupId>org.slf4j</groupId>

                   <artifactId>slf4j-api</artifactId>

                   <version>1.5.8</version>

              </dependency>

              <dependency>

                   <groupId>org.slf4j</groupId>

                   <artifactId>slf4j-jdk14</artifactId>

                   <version>1.5.8</version>

              </dependency>

              <dependency>

                  <groupId>net.sf.ehcache</groupId>

                  <artifactId>ehcache</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.hsqldb</groupId>

                  <artifactId>hsqldb-j5</artifactId>

                  <version>2.0.0</version>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-entitymanager</artifactId>

                  <version>3.6.3.Final</version>

              </dependency>

          </dependencies>

       

          <build>

              <finalName>preventivi</finalName>

       

              <plugins>

                  <plugin>

                      <artifactId>maven-checkstyle-plugin</artifactId>

                  </plugin>

                  <plugin>

                      <artifactId>maven-compiler-plugin</artifactId>

                  </plugin>

                  <plugin>

                      <groupId>org.mortbay.jetty</groupId>

                      <artifactId>maven-jetty-plugin</artifactId>

                      <version>6.1.18</version>

                      <configuration>

                          <scanIntervalSeconds>10</scanIntervalSeconds>

                          <connectors>

                              <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

                                  <port>${jetty.port}</port>

                                  <maxIdleTime>60000</maxIdleTime>

                              </connector>

                          </connectors>

                      </configuration>

                  </plugin>

                  <plugin>

                      <artifactId>maven-war-plugin</artifactId>

                      <configuration>

                          <webResources>

                              <resource>

                                  <directory>${basedir}/src/main/java</directory>

                                  <targetPath>/WEB-INF/src</targetPath>

                              </resource>

                          </webResources>

                      </configuration>

                  </plugin>

                  <plugin>

                      <groupId>net.kindleit</groupId>

                      <artifactId>maven-gae-plugin</artifactId>

                      <version>0.7.3</version>

                      <dependencies>

                          <dependency>

                              <groupId>net.kindleit</groupId>

                              <artifactId>gae-runtime</artifactId>

                              <version>${gae.version}</version>

                              <type>pom</type>

                              <exclusions>

                                  <exclusion>

                                      <groupId>com.google.appengine.orm</groupId>

                                      <artifactId>jdo2-api</artifactId>

                                  </exclusion>

                              </exclusions>

                          </dependency>

                      </dependencies>

                  </plugin>

              </plugins>

          </build>

       

          <profiles>

              <profile>

                  <id>gae</id>

                  <dependencies>

                      <dependency>

                          <groupId>net.sf.ehcache</groupId>

                          <artifactId>ehcache</artifactId>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>org.glassfish.web</groupId>

                          <artifactId>el-impl</artifactId>

                          <version>2.1.2-b04</version>

                      </dependency>

                      <dependency>

                          <groupId>javax.el</groupId>

                          <artifactId>el-api</artifactId>

                          <version>2.1.2-b04</version>

                      </dependency>

                      <dependency>

                          <groupId>org.apache.geronimo.specs</groupId>

                          <artifactId>geronimo-jta_1.1_spec</artifactId>

                          <version>1.1.1</version>

                      </dependency>

                      <dependency>

                          <groupId>xalan</groupId>

                          <artifactId>xalan</artifactId>

                          <version>2.7.1</version>

                          <scope>runtime</scope>

                      </dependency>

                      <dependency>

                          <groupId>xerces</groupId>

                          <artifactId>xercesImpl</artifactId>

                          <version>2.9.1</version>

                          <scope>runtime</scope>

                      </dependency>

                      <dependency>

                          <groupId>com.sun.faces</groupId>

                          <artifactId>jsf-api</artifactId>

                          <version>2.0.3-b03</version>

                      </dependency>

                      <dependency>

                          <groupId>com.sun.faces</groupId>

                          <artifactId>jsf-impl</artifactId>

                          <version>2.0.3-b03</version>

                      </dependency>

                  </dependencies>

                  <build>

                      <resources>

                          <resource>

                              <directory>src/main/resources</directory>

                          </resource>

                          <resource>

                              <directory>src/main/resources-gae</directory>

                          </resource>

                      </resources>

                      <plugins>

                          <plugin>

                              <groupId>org.codehaus.mojo</groupId>

                              <artifactId>build-helper-maven-plugin</artifactId>

                              <executions>

                                  <execution>

                                      <id>add-source</id>

                                      <phase>generate-sources</phase>

                                      <goals>

                                          <goal>add-source</goal>

                                      </goals>

                                      <configuration>

                                          <sources>

                                              <source>src/main/java-gae</source>

                                          </sources>

                                      </configuration>

                                  </execution>

                              </executions>

                          </plugin>

                          <plugin>

                              <artifactId>maven-war-plugin</artifactId>

                              <configuration>

                                  <webResources>

                                      <resource>

                                          <directory>src/main/webapp</directory>

                                          <excludes>

                                              <exclude>WEB-INF/web.xml</exclude>

                                              <exclude>WEB-INF/faces-config.xml</exclude>

                                          </excludes>

                                      </resource>

                                      <resource>

                                          <directory>src/main/webapp-gae</directory>

                                      </resource>

                                      <resource>

                                          <directory>${project.build.directory}/generated-resources</directory>

                                          <targetPath>static-resources</targetPath>

                                      </resource>

                                      <resource>

                                          <directory>${basedir}/src/main/java</directory>

                                          <targetPath>/WEB-INF/src</targetPath>

                                      </resource>

                                  </webResources>

                              </configuration>

                          </plugin>                   

                      </plugins>

                  </build>

              </profile>

              <profile>

                  <id>jdk5</id>

                  <activation>

                      <jdk>1.5</jdk>

                  </activation>

                  <dependencies>

                      <dependency>

                          <groupId>javax.xml.bind</groupId>

                          <artifactId>jaxb-api</artifactId>

                          <version>2.2</version>

                      </dependency>

                  </dependencies>

              </profile>

              <profile>

                  <id>release</id>

                  <build>

                      <plugins>

                          <plugin>

                              <artifactId>maven-war-plugin</artifactId>

                              <executions>

                                  <execution>

                                      <id>jee6</id>

                                      <phase>package</phase>

                                      <goals>

                                          <goal>war</goal>

                                      </goals>

                                      <configuration>

                                          <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>

                                          <classifier>jee6</classifier>

                                          <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*,WEB-INF/lib/jstl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*,WEB-INF/lib/slf4j-*</packagingExcludes>

                                          <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*,WEB-INF/lib/jstl-*,WEB-INF/lib/validation-api-*,WEB-INF/lib/hibernate-validator-*,WEB-INF/lib/slf4j-*</warSourceExcludes>

                                          <webResources>

                                              <resource>

                                                  <directory>${basedir}/src/main/java</directory>

                                                  <targetPath>/WEB-INF/src</targetPath>

                                              </resource>

                                          </webResources>

                                      </configuration>

                                  </execution>

                              </executions>

                              <configuration>

                                  <classifier>tomcat6</classifier>

                                  <webResources>

                                      <resource>

                                          <directory>${basedir}/src/main/java</directory>

                                          <targetPath>/WEB-INF/src</targetPath>

                                      </resource>

                                  </webResources>

                              </configuration>

                          </plugin>

       

                          <plugin>

                              <artifactId>maven-assembly-plugin</artifactId>

                              <executions>

                                  <execution>

                                      <id>group-sources</id>

                                      <goals>

                                          <goal>single</goal>

                                      </goals>

                                      <phase>package</phase>

                                      <configuration>

                                          <finalName>sources</finalName>

                                          <descriptor>assembler.xml</descriptor>

                                      </configuration>

                                  </execution>

                              </executions>

                          </plugin>

                          <plugin>

                              <artifactId>maven-jar-plugin</artifactId>

                              <executions>

                                  <execution>

                                      <goals>

                                          <goal>jar</goal>

                                      </goals>

                                      <phase>package</phase>

                                      <configuration>

                                          <classesDirectory>${basedir}/target/sources/sources</classesDirectory>

                                          <classifier>sources</classifier>

                                      </configuration>

                                  </execution>

                              </executions>

                          </plugin>

                      </plugins>

                  </build>

              </profile>

              <profile>

                  <id>jee6</id>

                  <build>

                      <plugins>

                          <plugin>

                              <artifactId>maven-war-plugin</artifactId>

                              <configuration>

                                  <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>

                                  <webResources>

                                      <resource>

                                          <directory>${basedir}/src/main/java</directory>

                                          <targetPath>/WEB-INF/src</targetPath>

                                      </resource>

                                  </webResources>

                              </configuration>

                          </plugin>

                      </plugins>

                  </build>

       

                  <dependencies>

                      <dependency>

                          <groupId>com.sun.faces</groupId>

                          <artifactId>jsf-api</artifactId>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>com.sun.faces</groupId>

                          <artifactId>jsf-impl</artifactId>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>javax.transaction</groupId>

                          <artifactId>jta</artifactId>

                          <version>1.1</version>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>javax.servlet</groupId>

                          <artifactId>jstl</artifactId>

                          <version>1.2</version>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                           <groupId>org.hibernate</groupId>

                           <artifactId>hibernate-validator</artifactId>

                           <version>4.1.0.Final</version>

                           <scope>provided</scope>

                      </dependency>

                      <dependency>

                           <groupId>javax.validation</groupId>

                           <artifactId>validation-api</artifactId>

                           <scope>provided</scope>

                      </dependency>

                  </dependencies>

              </profile>

              <profile>

                  <id>unpack-gae-sdk</id>

                  <activation>

                      <property>

                          <name>!gae.home</name>

                      </property>

                  </activation>

                  <dependencies>

                      <dependency>

                          <groupId>com.google.appengine</groupId>

                          <artifactId>appengine-java-sdk</artifactId>

                          <version>${gae.version}</version>

                          <type>zip</type>

                      </dependency>

                  </dependencies>

                  <build>

                      <plugins>

                          <plugin>

                              <groupId>net.kindleit</groupId>

                              <artifactId>maven-gae-plugin</artifactId>

                              <executions>

                                  <execution>

                                      <phase>package</phase>

                                      <goals>

                                          <goal>unpack</goal>

                                      </goals>

                                  </execution>

                              </executions>

                          </plugin>

                      </plugins>

                  </build>

              </profile>

          </profiles>

        

      </project>

       

      This is my web.xml:

       

      <?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="richfaces-showcase" version="2.5">

        <display-name>web-prova</display-name>

        <context-param>

          <param-name>org.richfaces.skin</param-name>

          <param-value>#{skinBean.skin}</param-value>

        </context-param>

        <context-param>

          <param-name>org.richfaces.fileUpload.maxRequestSize</param-name>

          <param-value>100000</param-value>

        </context-param>

        <context-param>

          <param-name>org.richfaces.fileUpload.createTempFiles</param-name>

          <param-value>false</param-value>

        </context-param>

        <context-param>

          <param-name>org.richfaces.resourceOptimization.enabled</param-name>

          <param-value>true</param-value>

        </context-param>

        <context-param>

          <param-name>javax.faces.PROJECT_STAGE</param-name>

          <param-value>Development</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>

        <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>/faces/*</url-pattern>

        </servlet-mapping>

        <welcome-file-list>

          <welcome-file>index.html</welcome-file>

          <welcome-file>index.htm</welcome-file>

          <welcome-file>index.jsp</welcome-file>

          <welcome-file>default.html</welcome-file>

          <welcome-file>default.htm</welcome-file>

          <welcome-file>default.jsp</welcome-file>

        </welcome-file-list>

        <mime-mapping>

          <extension>xcss</extension>

          <mime-type>text/css</mime-type>

        </mime-mapping>

        <login-config>

          <auth-method>BASIC</auth-method>

        </login-config>

        <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>

        <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>

      </web-app>

       

      The only page in redering is the follow:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich">

       

      <ui:composition template="/templates/main.xhtml">

          <ui:define name="body">

              <h:form prependId="false">

                  <h:outputLabel value="Name:" for="nameInput" />

                  <h:inputText id="nameInput" value="#{richBean.name}">

                      <a4j:ajax event="keyup" render="output" />

                  </h:inputText>

                  <h:panelGroup id="output">

                      <h:outputText value="Hello #{richBean.name}!"

                          rendered="#{not empty richBean.name}" />

                  </h:panelGroup>           

       

              </h:form>

              <rich:calendar />

          </ui:define>

       

      </ui:composition>

       

      </html>

       

       

      The html output is:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

      <title>RichFaces Showcase</title>

      <script type="text/javascript" src="RES_NOT_FOUND"></script>

      <script type="text/javascript" src="RES_NOT_FOUND"></script>

      <script type="text/javascript" src="RES_NOT_FOUND"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/json-dom.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/jquery.effects.core.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/jquery.effects.highlight.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/JQuerySpinBtn.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/calendar-utils.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      <script type="text/javascript"

          src="/preventivi/javax.faces.resource/calendar.js.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7?ln=org.richfaces"></script>

      </head>

      <body>

          <form id="j_idt6" name="j_idt6" method="post"

              action="/preventivi/welcome.jsf;jsessionid=bf198e4a02d200b70f6f80d1ddf7"

              enctype="application/x-www-form-urlencoded">

              <input type="hidden" name="j_idt6" value="j_idt6" /> <label

                  for="nameInput"> Name:</label><input id="nameInput" type="text"

                  name="nameInput" value="John"

                  onkeyup="RichFaces.ajax(this,event,{&quot;parameters&quot;:{&quot;javax.faces.behavior.event&quot;:&quot;keyup&quot;,&quot;org.richfaces.ajax.component&quot;:&quot;nameInput&quot;} ,&quot;sourceId&quot;:this} )" /><span

                  id="output">Hello John!</span><input type="hidden"

                  name="javax.faces.ViewState" id="javax.faces.ViewState"

                  value="H4sIAAAAAAAAAIVSv4sTQRR+t8neJXdBYg6uEbvj0MJd7JQgiuiR1dwptyiKhU52x2TCZGZu5u3ensWBjRY24o9O0MJGuM6/QOwEBVsrEVtrS53Zi0lAwQe7zMx773vf+97b/wG+MhoOD0lOggwZDzrEDDaI8he+vHu/cudzBbx1WOSSpOskQakjqONAUzOQPC3U2XPgrLFTs/+m/SoI88PbLMXTmYblW90SlxPRD670hjTB9uNPN142zXHuARTKJlSVNYS6ICMaCZVhtg17UJl6fAd3cvLqTU6+809ulT0NJ1y1IrhLEmqCRI6UFFRgcC26zujOlpS4elVLRTXuXqa7BsbWskw0HJoyvSiy0azTkpjnxGCUTpQq4yKBtE9169ur1z/vPzzlwVwEfk54Ri1ecxq3mY16VD/Yf3506dnXR38abzjd1/7NOEaCtGMVpjomOdU3P7w98/TFxw0PvC7UE0vGbFq9EFqlwKErE8aomei3u7BobE5aYiCsHEQwGcZUM8LZPdLjtF0oV/7YfwVzB7sNv8Zme+yCb5D0LfRaCV2EZXpIlOIsIcikCK3Mbtixi2sXbkTw16bMIdQ0SwbnKRGWyhGp+0EqExO4xwNGW2P3G9Z80qnl38vqVbcpDnLZDaZ6SQ5EYWe/OtvKDJdglsvsVB1EA2HpAs0pl2pkGy9+A0BsMbEPAwAA"

                  autocomplete="off" />

          </form>

          <span id="j_idt9"><span id="j_idt9Popup"

              style="white-space: nowrap;"><input class="rf-cal-inp "

                  id="j_idt9InputDate" name="j_idt9InputDate" readonly="readonly"

                  style="vertical-align: middle;" type="text" /><img alt=""

                  class="rf-cal-btn " id="j_idt9PopupButton"

                  style="vertical-align: middle" /><input autocomplete="off"

                  id="j_idt9InputCurrentDate" name="j_idt9InputCurrentDate"

                  style="display: none" type="hidden" value="07/2012" /></span><span

              id="j_idt9Content" style="display: none;"></span><span

              id="j_idt9Script" style="display: none;"><script

                      type="text/javascript">RichFaces.ui.Calendar.addLocale("en_US",

                          {"monthLabels":["January","February","March","April","May","June","July","August","September","October","November","December"] ,"minDaysInFirstWeek":1,"monthLabelsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] ,"firstWeekDay":0,"weekDayLabels":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] ,"weekDayLabelsShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] } );

                          new RichFaces.ui.Calendar("j_idt9",

                          "en_US",

                          {"currentDate":new Date(2012,6,6),"style":"z\u002Dindex: 3"} ).load();</script></span></span>

      </body>

      </html>

       

       


      Can anyone help me??

      Thanks in advance