4 Replies Latest reply on May 15, 2011 11:43 AM by ilya_shaikovsky

    Service Tracker has not been initialized? Maybe not compatible with myfaces extensions validator?

    prefabsoft

      Hi all,

       

      I'm trying myfaces for the first time but run into trouble using a simple example in my running JSF project:

       

      SEVERE: Error Rendering View[/views/demo.xhtml]

      javax.faces.FacesException: Service Tracker has not been initialized

                at org.richfaces.application.ServiceTracker.getServicesFactory(ServiceTracker.java:73)

                at org.richfaces.application.ServiceTracker.getService(ServiceTracker.java:66)

                at org.richfaces.component.behavior.ClientValidatorImpl.getValidators(ClientValidatorImpl.java:286)

                at org.richfaces.renderkit.html.ClientValidatorRenderer.createValidatorScript(ClientValidatorRenderer.java:145)

                at org.richfaces.renderkit.html.ClientValidatorRenderer.buildAndStoreValidatorScript(ClientValidatorRenderer.java:130)

                at org.richfaces.renderkit.html.ClientValidatorRenderer.getScript(ClientValidatorRenderer.java:64)

                at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:103)

                at org.richfaces.component.behavior.ClientValidatorImpl.getScript(ClientValidatorImpl.java:98)

                at com.sun.faces.renderkit.RenderKitUtils.getSingleBehaviorHandler(RenderKitUtils.java:1590)

                at com.sun.faces.renderkit.RenderKitUtils.renderHandler(RenderKitUtils.java:1690)

                at com.sun.faces.renderkit.RenderKitUtils.renderOnchange(RenderKitUtils.java:370)

                at com.sun.faces.renderkit.html_basic.TextRenderer.getEndTextToRender(TextRenderer.java:134)

                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:170)

                at org.apache.myfaces.extensions.validator.core.renderkit.ExtValLazyRendererProxy.encodeEnd(ExtValLazyRendererProxy.java:77)

                at org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.encodeEnd(ExtValRendererWrapper.java:312)

                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:883)

                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)

                at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

                at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

                at org.apache.myfaces.extensions.validator.core.renderkit.ExtValLazyRendererProxy.encodeChildren(ExtValLazyRendererProxy.java:70)

                at org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.encodeChildren(ExtValRendererWrapper.java:251)

                at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853)

                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1652)

                at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:278)

                at org.richfaces.renderkit.html.PanelRenderer.encodeEnd(PanelRenderer.java:181)

                at org.apache.myfaces.extensions.validator.core.renderkit.ExtValLazyRendererProxy.encodeEnd(ExtValLazyRendererProxy.java:77)

                at org.apache.myfaces.

       

      Looks like RichFaces is not compatible with org.apache.myfaces.extensions.validator...could that be?

       

      All comments, suggestion more than welcome!

       

      Best wishes,

       

      Jochen

        • 1. Service Tracker has not been initialized? Maybe not compatible with myfaces extensions validator?
          mp911de

          Hi Jochen,

          looks like a needed Initialization is not done. What is your Runtime (JBoss, Tomcat, other?), which RichFaces Version do you use, and how does your web.xml look like?

          Best regards,

          Mark

          • 2. Re: Service Tracker has not been initialized? Maybe not compatible with myfaces extensions validator?
            prefabsoft

            Hello Mark,

             

            Thanks for the fast reply! Really appreciate your feedback.

             

            I just dropped Richfaces into my current JSF project which is actually backed by Spring...and haven't done any explicit initialization for Richfaces indeed. I guess this isn't the most straight forward setup, but I already got the primefaces lib running succesfully (more or less) in this project, and I've read online somehere that Rich- and Primefaces should run nicely hand in hand...so this is what I was trying to accomplish...

             

            Will post my web.xml and faces-config.xml down below:

             

            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"

                      version="2.5">

                      <display-name>PrefabServer</display-name>

                      <description>Roo generated PrefabServer application</description>

             

             

                      <welcome-file-list>

                       <welcome-file>faces/views/index.xhtml</welcome-file>

                      </welcome-file-list>

             

                      <context-param>

                                <param-name>defaultHtmlEscape</param-name>

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

                      </context-param>

                      <context-param>

                                <param-name>contextConfigLocation</param-name>

                                <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>

                      </context-param>

                      <filter>

                                <filter-name>CharacterEncodingFilter</filter-name>

                                <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

                                <init-param>

                                          <param-name>encoding</param-name>

                                          <param-value>UTF-8</param-value>

                                </init-param>

                                <init-param>

                                          <param-name>forceEncoding</param-name>

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

                                </init-param>

                      </filter>

                      <filter>

                                <filter-name>HttpMethodFilter</filter-name>

                                <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>

                      </filter>

                      <filter>

                                <filter-name>springSecurityFilterChain</filter-name>

                                <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

                      </filter>

                      <filter>

                                <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

                                <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>

                      </filter>

                      <filter-mapping>

                                <filter-name>CharacterEncodingFilter</filter-name>

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

                      </filter-mapping>

                      <filter-mapping>

                                <filter-name>HttpMethodFilter</filter-name>

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

                      </filter-mapping>

                      <filter-mapping>

                                <filter-name>springSecurityFilterChain</filter-name>

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

                      </filter-mapping>

                      <filter-mapping>

                                <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

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

                      </filter-mapping>

                      <listener>

                                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                      </listener>

                      <servlet>

                                <servlet-name>PrefabServer</servlet-name>

                                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

                                <init-param>

                                          <param-name>contextConfigLocation</param-name>

                                          <param-value>/WEB-INF/spring/webmvc-config.xml</param-value>

                                </init-param>

                                <load-on-startup>1</load-on-startup>

                      </servlet>

                      <servlet-mapping>

                                <servlet-name>PrefabServer</servlet-name>

                                <url-pattern>/</url-pattern>

                      </servlet-mapping>

                      <session-config>

                                <session-timeout>10</session-timeout>

                      </session-config>

                      <error-page>

                                <exception-type>java.lang.Exception</exception-type>

                                <location>/uncaughtException</location>

                      </error-page>

                      <error-page>

                                <error-code>404</error-code>

                                <location>/resourceNotFound</location>

                      </error-page>

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

                                <url-pattern>*.jsf</url-pattern>

                      </servlet-mapping>

                      <context-param>

                                <param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>

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

                      </context-param>

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

             

            And faces-config.xml:


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

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

                                <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>

              </application>

            </faces-config>

             

             

            Thanks a lot in advance and best wishes,

             

            Jochen

             

            EDIT: Oh yeah, and my server is a Tomcat 7 (VMWare vFabric tc Server Developer Edition to be precise)

            • 3. Service Tracker has not been initialized? Maybe not compatible with myfaces extensions validator?
              mp911de

              Hi Jochen,

              your config is fine. Richfaces is initialized by the ConfigureListener. I don't have an idea, what else could be wrong (have you tried without MyFaces?). To skip the Exception (but I don't know if it will work then) you could easily prepare an own ContextListener where you call:

               

              ServiceTracker.setFactory(new ServicesFactoryImpl());

               

              Best regards,

              Mark

              • 4. Service Tracker has not been initialized? Maybe not compatible with myfaces extensions validator?
                ilya_shaikovsky

                you talking about myFAces  but using a few mojara definitions in web.bxml.. maybe that's the case? and in general maybe you mixed both impl jars? That's should not be used like that.

                 

                   <listener>

                                    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

                          </listener>

                          <context-param>

                                    <param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>

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

                          </context-param>