Search code examples
jsftomcatconfigurationrichfaces

richfaces + eclipse ee + tomcat 7


am having a problem configuring tomcat with richfaces. I copied the:

richfaces-components-ui-4.2.2.Final.jar
richfaces-components-api-4.2.2.Final.jar
richfaces-core-api-4.2.2.Final.jar
richfaces-core-impl-4.2.2.Final.jar

jars into tomcat's \lib and restarted my server. The definition of my xhtml page looks like this:

  <html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:a4j="http://richfaces.org/a4j"
     xmlns:rich="http://richfaces.org/rich">

But eclipse generates a warning which says

NSL missing: CANNOT_FIND_FACELET_TAGLIB in : org.eclipse.jst.jsf.core.validation.internal.facelet.messages

Is there any other thing I need to configure? I skimmed a lot of tutorials but almost all uses JBoss. Is there a way to configure richfaces with my eclipse and tomcat?


Edited

When I add the jars as external jars, and add the dependencies too, it does not crash the site,though in the console it produces a this:

Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getLongInitParameter
INFO: No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getStringInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS' found, using default value auto
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VALIDATE_XML' found, using default value false
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG' found, using default value true
Jun 10, 2012 2:15:55 PM org.apache.myfaces.shared_impl.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Jun 10, 2012 2:15:55 PM org.apache.myfaces.config.FacesConfigurator feedStandardConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator getWebAppConfig
INFO: Reading config /WEB-INF/faces-config.xml
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: Starting up MyFaces-package : myfaces-api in version : 2.0.2 from path : file:/D:/Programming/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/OnTheRun/WEB-INF/lib/myfaces-api-2.0.2.jar
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: Starting up MyFaces-package : myfaces-impl in version : 2.0.2 from path : file:/D:/Programming/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/OnTheRun/WEB-INF/lib/myfaces-impl-2.0.2.jar
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tomahawk not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tomahawk12 not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tomahawk-sandbox not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tomahawk-sandbox12 not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tomahawk-sandbox15 not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : myfaces-orchestra-core not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : myfaces-orchestra-core12 not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : trinidad-api not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : trinidad-impl not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : tobago not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : commons-el not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator startLib
INFO: MyFaces-package : jsp-api not found.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.util.ExternalSpecifications isBeanValidationAvailable
INFO: MyFaces Bean Validation support disabled
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.FacesConfigurator handleSerialFactory
INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
Jun 10, 2012 2:15:56 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
INFO: Using LifecycleProvider java.lang.String
Jun 10, 2012 2:15:56 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
INFO: ServletContext 'D:\Programming\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\OnTheRun\' initialized.
Jun 10, 2012 2:15:56 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces

Which I assume is because some libraries are missing


UPDATE

Here are my config files:

<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_2_0.xsd"
version="2.0">
<application>
    <resource-bundle>
        <base-name>on.run.messages</base-name>
        <var>msgs</var>
    </resource-bundle>
</application>




<navigation-rule>
        <from-view-id>/login.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>secret</from-outcome>
        <to-view-id>/restricted/transactions.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>



</faces-config>

and

<?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_3_0.xsd" version="3.0">
  <display-name>OnTheRun</display-name>

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

<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

<filter>
        <filter-name>AuthFilter</filter-name>
        <filter-class>on.run.AuthFilter</filter-class>
 </filter>
 <filter-mapping>
        <filter-name>AuthFilter</filter-name>
        <url-pattern>/restricted/*</url-pattern>
 </filter-mapping>

<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
</web-app>

I also tried tomahawk lib, but I removed it and cleaned the project. I tried this example to test richface but there is nothing displayed.

The console message still remains valid, even though I don't have any reference to tomahawk neither I have it in my buildpath and the project and server is clean. I also tried to add to the buildpath myfaces-impl.jar, does not help. The same console messages come up.


Solution

  • But eclipse generates a warning which says

    NSL missing: CANNOT_FIND_FACELET_TAGLIB in : org.eclipse.jst.jsf.core.validation.internal.facelet.messages
    

    That's because you placed the RichFaces libraries in Tomcat instead of in webapp itself. Those libraries are supposed to be placed in webapp's own /WEB-INF/lib. Otherwise you need to add the RichFaces libraries to the server-supplied libraries in Eclipse project buildpath settings. Eclipse namely doesn't expect that you modify the default libraries of Tomcat.


    When I add the jars as external jars, and add the dependencies too, it does not crash the site,though in the console it produces a this:

    Those are just INFO messages, not WARNING messages. This is specific to MyFaces and those are just to inform the developer/serveradmin what actions MyFaces has taken as to setting some applicationwide parameters. Just ignore them. Only once you get a WARNING, SEVERE, ERROR or FATAL, then you may start worrying. You do not necessarily need Tomahawk.