10 Replies Latest reply on Nov 11, 2007 7:05 AM by pmdo

    Richfaces and eclipse (cant get started)

    pmdo

      I use Eclipse3.3.1.1 and Tomcat 6.0.14 for JSF and want to get
      started with Richfaces (demo: Ajax Echo)...

      I copy "richfaces-api-3.1.1_GA.jar" (impl and ui) into eclipse
      (WEB-INF/lib) and do everything like in the userguide...
      But it doesnt work!!

      When I copy the 3 jar-files in another jsf-project, this project
      doesnt work anymore...

      What I have to do (step-by-step) for a running project under
      eclipse????

        • 1. Re: Richfaces and eclipse (cant get started)
          dmitry.demyankov

          Have you read Chapter 3 of Developer Guide?

          • 2. Re: Richfaces and eclipse (cant get started)
            pmdo

            Yes, I did! (there is the echo-example)...

            • 3. Re: Richfaces and eclipse (cant get started)
              dmitry.demyankov

              What exactly is the problem? I mean 'it doesn't work' is a bit too general explanation.. Any exceptions, errors? Which jars are you using in your project?

              • 4. Re: Richfaces and eclipse (cant get started)
                pmdo

                Ok, here is a very simple running jsf-example...
                I copy "richfaces-api-3.1.2.GA.jar", "richfaces-impl-3.1.2.GA.jar"
                and "richfaces-ui-3.1.2.GA.jar" in the lib-folder.

                => WEB-INF/lib:
                jsf-api.jar
                jsf-impl.jar
                jstl.jar
                richfaces-api-3.1.2.GA.jar
                richfaces-impl-3.1.2.GA.jar
                richfaces-ui-3.1.2.GA.jar
                standard.jar

                => web.xml

                <?xml version="1.0"?>
                <web-app 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"
                 version="2.5">
                 <context-param>
                 <param-name>org.richfaces.SKIN</param-name>
                 <param-value>blueSky</param-value>
                 </context-param>
                 <filter>
                 <display-name>RichFaces Filter</display-name>
                 <filter-name>richfaces</filter-name>
                 <filter-class>org.ajax4jsf.Filter</filter-class>
                 </filter>
                 <filter-mapping>
                 <filter-name>richfaces</filter-name>
                 <servlet-name>Faces Servlet</servlet-name>
                 <dispatcher>REQUEST</dispatcher>
                 <dispatcher>FORWARD</dispatcher>
                 <dispatcher>INCLUDE</dispatcher>
                 </filter-mapping>
                
                 <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>
                
                 <welcome-file-list>
                 <welcome-file>index.html</welcome-file>
                 </welcome-file-list>
                </web-app>


                => faces-config.xml
                <?xml version="1.0"?>
                <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_1_2.xsd"
                 version="1.2">
                
                 <!-- Navigationsregeln -->
                 <navigation-rule>
                 <from-view-id>/index.jsp</from-view-id>
                 <navigation-case>
                 <from-outcome>login</from-outcome>
                 <to-view-id>/welcome.jsp</to-view-id>
                 </navigation-case>
                 </navigation-rule>
                
                 <managed-bean>
                 <managed-bean-name>user</managed-bean-name>
                 <managed-bean-class>com.test.UserBean</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 </managed-bean>
                
                 <application>
                 <resource-bundle>
                 <base-name>com.test.messages</base-name>
                 <var>msgs</var>
                 </resource-bundle>
                 </application>
                
                 <application>
                 <locale-config>
                 <default-locale>en</default-locale>
                 <supported-locale>de</supported-locale>
                 </locale-config>
                 </application>
                </faces-config>
                


                the index.html
                <html>
                 <head>
                 <meta http-equiv="Refresh" content= "0; URL=index.faces"/>
                 <title>Startseite</title>
                 </head>
                 <body>
                 <p>loading application...</p>
                 </body>
                </html>


                the index.jsp:
                <html>
                 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                 <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                 <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                 <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                 <f:view>
                 <head>
                 <title><h:outputText value="#{msgs.indexTitel}"/></title>
                 </head>
                 <body>
                 <h:form>
                 <h3><h:outputText value="#{msgs.indexUeberschrift}"/></h3>
                 <h:messages />
                 <table>
                 <tr>
                 <td><h:outputText value="#{msgs.bezName}"/></td>
                 <td>
                 <h:inputText value="#{user.name}" required="true" requiredMessage="#{msgs.errorName}">
                 <f:validateLength minimum="4" maximum="10" />
                 </h:inputText>
                 </td>
                 </tr>
                 <tr>
                 <td><h:outputText value="#{msgs.bezPasswort}"/></td>
                 <td>
                 <h:inputSecret value="#{user.password}" required="true">
                 <f:validateLength minimum="6" maximum="8" />
                 </h:inputSecret>
                
                 </td>
                 </tr>
                 </table>
                 <p>
                 <h:commandButton value="#{msgs.buttonLogin}" action="login"/>
                 </p>
                 </h:form>
                 </body>
                 </f:view>
                </html>


                the welcome.jsp:
                <html>
                 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                 <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                 <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                 <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                 <f:view>
                 <head>
                 <title><h:outputText value="#{msgs.welcomeTitel}"/></title>
                 </head>
                 <body>
                 <h:form>
                 <h3>
                 <h:outputText value="#{msgs.welcomeText}"/>,
                 <h:outputText value="#{user.name}"/>!
                 </h3>
                 <h5><h:outputText value="#{msgs.welcomePasswort}"/>: <h:outputText value="#{user.password}" /></h5>
                 </h:form>
                 </body>
                 </f:view>
                </html>


                In this example (I think everybody knows it! ;-)) I don`t use any rich-tag.

                Tomcat-error-messages:
                message /Testen/index.html
                description The requested resource (/Testen/index.html) is not available.


                08.11.2007 16:13:37 org.apache.catalina.core.AprLifecycleListener init
                INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0_03\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jre1.6.0_03\bin\client;C:\Program Files\Java\jre1.6.0_03\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static
                08.11.2007 16:13:37 org.apache.coyote.http11.Http11Protocol init
                INFO: Initializing Coyote HTTP/1.1 on http-8080
                08.11.2007 16:13:37 org.apache.catalina.startup.Catalina load
                INFO: Initialization processed in 804 ms
                08.11.2007 16:13:37 org.apache.catalina.core.StandardService start
                INFO: Starting service Catalina
                08.11.2007 16:13:37 org.apache.catalina.core.StandardEngine start
                INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
                08.11.2007 16:13:38 com.sun.faces.config.ConfigureListener contextInitialized
                INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b09-FCS) for context '/Testen'
                08.11.2007 16:13:39 org.apache.catalina.core.StandardContext listenerStart
                SCHWERWIEGEND: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
                java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
                 at org.ajax4jsf.application.DebugLifecycleFactory.<clinit>(DebugLifecycleFactory.java:39)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                 at java.lang.reflect.Constructor.newInstance(Unknown Source)
                 at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:567)
                 at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:460)
                 at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
                 at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:882)
                 at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:541)
                 at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:438)
                 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
                 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
                 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                 at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
                 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
                08.11.2007 16:13:39 org.apache.catalina.core.StandardContext start
                SCHWERWIEGEND: Error listenerStart
                08.11.2007 16:13:39 org.apache.catalina.core.StandardContext start
                SCHWERWIEGEND: Context [/Testen] startup failed due to previous errors
                08.11.2007 16:13:39 org.apache.coyote.http11.Http11Protocol start
                INFO: Starting Coyote HTTP/1.1 on http-8080
                08.11.2007 16:13:39 org.apache.jk.common.ChannelSocket init
                INFO: JK: ajp13 listening on /0.0.0.0:8009
                08.11.2007 16:13:39 org.apache.jk.server.JkMain start
                INFO: Jk running ID=0 time=0/31 config=null
                08.11.2007 16:13:39 org.apache.catalina.startup.Catalina start
                INFO: Server startup in 1572 ms


                Where is the problem, what did I wrong?!

                • 5. Re: Richfaces and eclipse (cant get started)
                  ilya_shaikovsky

                  commons* libraries absent

                  • 6. Re: Richfaces and eclipse (cant get started)
                    pmdo

                    ok...?! What can I do therefor??!!

                    • 7. Re: Richfaces and eclipse (cant get started)
                      dmitry.demyankov

                      Which jars do you have in WEB-INF/lib?

                      • 8. Re: Richfaces and eclipse (cant get started)
                        pmdo

                        WEB-INF/lib for this example:

                        jsf-api.jar
                        jsf-impl.jar
                        jstl.jar
                        richfaces-api-3.1.2.GA.jar
                        richfaces-impl-3.1.2.GA.jar
                        richfaces-ui-3.1.2.GA.jar
                        standard.jar


                        • 9. Re: Richfaces and eclipse (cant get started)
                          dmitry.demyankov

                          Add common-annotations, commons-beanutils, commons-codec, commons-collections, commons-digister, commons-logging jar files (maybe some of these are not really necessary..)

                          You can find them here - http://commons.apache.org/

                          • 10. Re: Richfaces and eclipse (cant get started)
                            pmdo

                            Thank you very much!! Now with all jars it works fine...
                            I will try, what jar´s I really need...
                            Thanx!!